diff options
Diffstat (limited to 'gcc/ada/sem_attr.adb')
-rw-r--r-- | gcc/ada/sem_attr.adb | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/gcc/ada/sem_attr.adb b/gcc/ada/sem_attr.adb index c067d88..c17f673 100644 --- a/gcc/ada/sem_attr.adb +++ b/gcc/ada/sem_attr.adb @@ -1014,16 +1014,20 @@ package body Sem_Attr is Q : Node_Id := Parent (N); begin - while Present (Q) - and then Nkind (Q) /= N_Component_Declaration - loop + while Present (Q) loop + if Nkind (Q) = N_Component_Declaration then + Set_Has_Per_Object_Constraint + (Defining_Identifier (Q), True); + exit; + + -- Prevent the search from going too far + + elsif Is_Body_Or_Package_Declaration (Q) then + exit; + end if; + Q := Parent (Q); end loop; - - if Present (Q) then - Set_Has_Per_Object_Constraint - (Defining_Identifier (Q), True); - end if; end; if Nkind (P) = N_Expanded_Name then |