[COMMITTED,22/30] ada: Handle accessibility calculations for 'First and 'Last

Message ID 20240520074858.222435-22-poulhies@adacore.com
State Committed
Commit b226e5605a6e1833da85590b10a5acf0b16d00d8
Headers
Series [COMMITTED,01/30] ada: Rework and augment documentation on strict aliasing |

Commit Message

Marc Poulhiès May 20, 2024, 7:48 a.m. UTC
  From: Justin Squirek <squirek@adacore.com>

This patch fixes a crash in the compiler whereby calculating the accessibility
level of of a local variable whose original expression is an 'First on an
array type led to an error during compilation.

gcc/ada/

	* accessibility.adb (Accessibility_Level): Add cases for 'First
	and 'Last.

Tested on x86_64-pc-linux-gnu, committed on master.

---
 gcc/ada/accessibility.adb | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
  

Patch

diff --git a/gcc/ada/accessibility.adb b/gcc/ada/accessibility.adb
index c0a9d50f38a..33ce001718a 100644
--- a/gcc/ada/accessibility.adb
+++ b/gcc/ada/accessibility.adb
@@ -465,7 +465,15 @@  package body Accessibility is
             --  so handle these cases explicitly.
 
             elsif Attribute_Name (E)
-                    in Name_Old | Name_Loop_Entry | Name_Result | Name_Super
+                    in Name_Old        |
+                       Name_Loop_Entry |
+                       Name_Result     |
+                       Name_Super      |
+                       Name_Tag        |
+                       Name_Safe_First |
+                       Name_Safe_Last  |
+                       Name_First      |
+                       Name_Last
             then
                --  Named access types