https://gcc.gnu.org/g:1850d0dbd32cf0b2cfa3225f0f8fbe1754b37393
commit r15-5394-g1850d0dbd32cf0b2cfa3225f0f8fbe1754b37393 Author: squirek <squi...@adacore.com> Date: Thu Oct 24 17:02:53 2024 +0000 ada: Crash on 'Access for Stream_Element_Array object This patch fixes a crash in the compiler when the actual for an anonymous access type formal is an 'Access of a Sream_Element_Array object during the calculation of said actual's accessibility level. gcc/ada/ChangeLog: * accessibility.adb (Accessibility_Level): Handle the Input attribute case Diff: --- gcc/ada/accessibility.adb | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/gcc/ada/accessibility.adb b/gcc/ada/accessibility.adb index a4129819109d..376eb9d0bb94 100644 --- a/gcc/ada/accessibility.adb +++ b/gcc/ada/accessibility.adb @@ -464,6 +464,23 @@ package body Accessibility is if Attribute_Name (E) = Name_Access then return Accessibility_Level (Prefix (E)); + -- If we have reached a 'Input attribute then this is the + -- the result of the expansion of an object declaration with + -- an initial value featuring it. Is this the only case ??? + + -- For example: + + -- Opaque : aliased Stream_Element_Array := + -- Stream_Element_Array'Input (S); + + elsif Attribute_Name (E) = Name_Input then + + -- Return the level of the enclosing declaration + + return Make_Level_Literal + (Innermost_Master_Scope_Depth + (Enclosing_Declaration (Expr))); + -- Unchecked or unrestricted attributes have unlimited depth elsif Attribute_Name (E) in Name_Address