]> git.ipfire.org Git - thirdparty/gcc.git/commit
ada: Rework fix for wrong finalization of qualified aggregate in allocator
authorEric Botcazou <ebotcazou@adacore.com>
Mon, 20 Nov 2023 07:58:52 +0000 (08:58 +0100)
committerMarc Poulhiès <poulhies@adacore.com>
Thu, 30 Nov 2023 10:12:49 +0000 (11:12 +0100)
commit8f9956fc5cdc1eef1260468ee503b5aa8fddd40c
tree0c94d1961e4a7ed96312c4fdbbca96c7eae0b479
parent262229e1e61c5130c7d5f1b4fa4e77ff60c9bc86
ada: Rework fix for wrong finalization of qualified aggregate in allocator

The problem is that there is no easy method to insert an action after an
arbitrary node in the tree, so the original fix does not correctly work
when the allocator is nested in another expression.

Therefore this moves the burden of the insertion from Apply_Predicate_Check
to Expand_Allocator_Expression and restricts the new processing to the case
where it is really required.

gcc/ada/

* checks.ads (Apply_Predicate_Check): Add Deref boolean parameter.
* checks.adb (Apply_Predicate_Check): Revert latest change. Use
Loc local variable to hold the source location. Use a common code
path for the generic processing and make a dereference if Deref is
True.
* exp_ch4.adb (Expand_Allocator_Expression): Compute Aggr_In_Place
earlier. If it is true, do not call Apply_Predicate_Check on the
expression on entry but on the temporary on exit with a
dereference.
* sem_res.adb (Resolve_Actuals): Add explicit parameter
association in call to Apply_Predicate_Check.
gcc/ada/checks.adb
gcc/ada/checks.ads
gcc/ada/exp_ch4.adb
gcc/ada/sem_res.adb