[gcc r17-1308] ada: Attribute reference in subunit causes compiler Assertion_Error
Marc Poulhies
dkm@gcc.gnu.org
Thu Jun 4 08:47:39 GMT 2026
https://gcc.gnu.org/g:1025bb39ef4bf810ff996530ba49955749242824
commit r17-1308-g1025bb39ef4bf810ff996530ba49955749242824
Author: Steve Baird <baird@adacore.com>
Date: Wed May 13 15:56:17 2026 -0700
ada: Attribute reference in subunit causes compiler Assertion_Error
In the case of a separate subunit subprogram body, do not take a path that
is intended for the case where there is no enclosing declaration list.
The subunit's stub has an enclosing declaration list.
gcc/ada/ChangeLog:
* exp_attr.adb (Build_And_Insert_Type_Attr_Subp): Test for subunit case before
concluding that a subprogram body has no enclosing declaration list.
Diff:
---
gcc/ada/exp_attr.adb | 1 +
1 file changed, 1 insertion(+)
diff --git a/gcc/ada/exp_attr.adb b/gcc/ada/exp_attr.adb
index 32b8297cd580..d1b9510ce120 100644
--- a/gcc/ada/exp_attr.adb
+++ b/gcc/ada/exp_attr.adb
@@ -2197,6 +2197,7 @@ package body Exp_Attr is
(No (Insertion_Point)
or else List_Containing (Insertion_Point) /=
Declarations (Ancestor))
+ and then Nkind (Parent (Ancestor)) /= N_Subunit
then
Insertion_Point := First (Declarations (Ancestor));
Skip_Non_Source_Subps;
More information about the Gcc-cvs
mailing list