ada: Fix internal error on loop iterator filter with -gnatVa
commita8c45d3fba65fa4e83903ffcba678eb497c2b07b
authorEric Botcazou <ebotcazou@adacore.com>
Wed, 17 May 2023 15:05:14 +0000 (17 17:05 +0200)
committerMarc Poulhiès <poulhies@adacore.com>
Thu, 15 Jun 2023 07:59:37 +0000 (15 09:59 +0200)
treefe945ad63ed0e288adffcf563004396842bc2ff1
parent9cdaa52bf8e0529c3d4d13121c440f92113ff05d
ada: Fix internal error on loop iterator filter with -gnatVa

The problem is that the condition of the iterator filter is expanded early,
before it is integrated into an if statement of the loop body, so there is
no place to attach the actions generated by this expansion.

This happens only for simple loops, i.e. with a parameter specification, so
the fix uses the same approach for them as for loops based on iterators.

gcc/ada/

* sinfo.ads (Iterator_Filter): Document field.
* sem_ch5.adb (Analyze_Iterator_Specification): Move comment around.
(Analyze_Loop_Parameter_Specification): Only preanalyze the iterator
filter, if any.
* exp_ch5.adb (Expand_N_Loop_Statement): Analyze the new list built
when an iterator filter is present.
gcc/ada/exp_ch5.adb
gcc/ada/sem_ch5.adb
gcc/ada/sinfo.ads