diff options
author | Ed Schonberg <schonberg@adacore.com> | 2020-03-25 12:49:13 -0400 |
---|---|---|
committer | Pierre-Marie de Rodat <derodat@adacore.com> | 2020-06-12 04:29:27 -0400 |
commit | 834bb57ac5a28e740b8f6e55059a102b99380176 (patch) | |
tree | b4713691503071d4687babdbd70609f6cb9dd8df /gcc | |
parent | a80b1eb72d6f227fc7d1cca36a6c29614a80ab10 (diff) | |
download | gcc-834bb57ac5a28e740b8f6e55059a102b99380176.zip gcc-834bb57ac5a28e740b8f6e55059a102b99380176.tar.gz gcc-834bb57ac5a28e740b8f6e55059a102b99380176.tar.bz2 |
[Ada] Compiler locks up with -gnatX and formal subprogram with aspects
2020-06-12 Ed Schonberg <schonberg@adacore.com>
gcc/ada/
* sem_ch12.adb (Find_Matching_Actual): Add guard on search loops
to detect a compilation error when using a compiler built
without assertions.
(Instantiate_Formal_Subprogram): Create a new subprogram name
for the actual only if formal has contract aspects and expansion
is enabled.
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ada/sem_ch12.adb | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/gcc/ada/sem_ch12.adb b/gcc/ada/sem_ch12.adb index 26987d5..8972bed 100644 --- a/gcc/ada/sem_ch12.adb +++ b/gcc/ada/sem_ch12.adb @@ -10403,7 +10403,9 @@ package body Sem_Ch12 is => Formal_Ent := Defining_Identifier (F); - while Chars (Act) /= Chars (Formal_Ent) loop + while Present (Act) + and then Chars (Act) /= Chars (Formal_Ent) + loop Next_Entity (Act); end loop; @@ -10414,7 +10416,9 @@ package body Sem_Ch12 is => Formal_Ent := Defining_Entity (F); - while Chars (Act) /= Chars (Formal_Ent) loop + while Present (Act) + and then Chars (Act) /= Chars (Formal_Ent) + loop Next_Entity (Act); end loop; @@ -10934,13 +10938,16 @@ package body Sem_Ch12 is -- Create new entity for the actual (New_Copy_Tree does not), and -- indicate that it is an actual. - -- If the actual is not an entity and the formal includes aspect - -- specifications for contracts, we create an internal name for - -- the renaming declaration. The constructed wrapper contains a - -- call to the entity in the renaming. + -- If the actual is not an entity (i.e. an attribute reference) + -- and the formal includes aspect specifications for contracts, + -- we create an internal name for the renaming declaration. The + -- constructed wrapper contains a call to the entity in the renaming. + -- This is an expansion activity, as is the wrapper creation. if Ada_Version >= Ada_2020 - and then Present (Aspect_Specifications (Analyzed_Formal)) + and then Has_Contracts (Analyzed_Formal) + and then not Is_Entity_Name (Actual) + and then Expander_Active then New_Subp := Make_Temporary (Sloc (Actual), 'S'); Set_Defining_Unit_Name (New_Spec, New_Subp); |