diff options
author | Gary Dismukes <dismukes@adacore.com> | 2023-11-30 19:28:42 +0000 |
---|---|---|
committer | Marc Poulhiès <poulhies@adacore.com> | 2023-12-19 15:27:50 +0100 |
commit | b09d948e0520574d40587c086fa43ade7316d466 (patch) | |
tree | 89fe7574e242217c50ad88a0a6477c4e7bf14af5 /gcc/ada | |
parent | b90089402f79ef4be049001c381dd6446af437a5 (diff) | |
download | gcc-b09d948e0520574d40587c086fa43ade7316d466.zip gcc-b09d948e0520574d40587c086fa43ade7316d466.tar.gz gcc-b09d948e0520574d40587c086fa43ade7316d466.tar.bz2 |
ada: Compiler hangs on container aggregate with function call as key expression
The compiler hangs (or may crash, if assertions are enabled) when compiling
an iterated association of a container aggregate that has a key expression
given by a function call. The resolution of the call leads to a blowup in
Build_Call_Marker, because the temporary copy of the expression that's
analyzed has an Empty parent, causing insertion of the call marker to fail.
The fix for this is to preanalyze, rather than analyze, the copy of the key
expression (Build_Call_Marker will return without creating a call marker in
the case of preanalysis).
gcc/ada/
* sem_aggr.adb (Resolve_Iterated_Association): Call
Preanalyze_And_Resolve instead of Analyze_And_Resolve on a key
expression of an iterated association.
Diffstat (limited to 'gcc/ada')
-rw-r--r-- | gcc/ada/sem_aggr.adb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/gcc/ada/sem_aggr.adb b/gcc/ada/sem_aggr.adb index a61326c..bf24962 100644 --- a/gcc/ada/sem_aggr.adb +++ b/gcc/ada/sem_aggr.adb @@ -3270,13 +3270,13 @@ package body Sem_Aggr is (Iterator_Specification (Comp))); end if; - -- Key expression must have the type of the key. We analyze + -- Key expression must have the type of the key. We preanalyze -- a copy of the original expression, because it will be -- reanalyzed and copied as needed during expansion of the -- corresponding loop. Key_Expr := Key_Expression (Comp); - Analyze_And_Resolve (New_Copy_Tree (Key_Expr), Key_Type); + Preanalyze_And_Resolve (New_Copy_Tree (Key_Expr), Key_Type); End_Scope; Typ := Key_Type; |