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.
(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;