ada: Fix double finalization of case expression in concatenation
commit3d3930f52aaeb53b9c6460459b8711fc527d6741
authorEric Botcazou <ebotcazou@adacore.com>
Sat, 17 Jun 2023 21:46:54 +0000 (17 23:46 +0200)
committerMarc Poulhiès <poulhies@adacore.com>
Tue, 27 Jun 2023 12:05:51 +0000 (27 14:05 +0200)
tree85f35462ee9acbb600cd8476aaa5e825078cc5f6
parentd47dbbd22fcb4fd26f7a9b66bd99dcf4518deea9
ada: Fix double finalization of case expression in concatenation

This streamlines the expansion of case expressions by not wrapping them in
an Expression_With_Actions node when the type is not by copy, which avoids
the creation of a temporary and the associated finalization issues.

That's the same strategy as the one used for the expansion of if expressions
when the type is by reference, unless Back_End_Handles_Limited_Types is set
to True. Given that it is never set to True, except by a debug switch, and
has never been implemented, this parameter is removed in the process.

gcc/ada/

* debug.adb (d.L): Remove documentation.
* exp_ch4.adb (Expand_N_Case_Expression): In the not-by-copy case,
do not wrap the case statement in an Expression_With_Actions node.
(Expand_N_If_Expression): Do not test
Back_End_Handles_Limited_Types
* gnat1drv.adb (Adjust_Global_Switches): Do not set it.
* opt.ads (Back_End_Handles_Limited_Types): Delete.
gcc/ada/debug.adb
gcc/ada/exp_ch4.adb
gcc/ada/gnat1drv.adb
gcc/ada/opt.ads