From: Steve Baird <[email protected]>
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.
Tested on x86_64-pc-linux-gnu, committed on master.
---
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 32b8297cd58..d1b9510ce12 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;
--
2.53.0