aboutsummaryrefslogtreecommitdiff
path: root/config
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2023-04-03 10:53:30 +0200
committerMarc Poulhiès <poulhies@adacore.com>2023-05-29 10:23:20 +0200
commit21b0ecb9853071f0642ee1fba7861e69789d0727 (patch)
treec05f35cbc92b42a2ad587c7224d5fb254c4a23cd /config
parent4017d7fddda521dda5f0bc2c89942246d0aeedab (diff)
downloadgcc-21b0ecb9853071f0642ee1fba7861e69789d0727.zip
gcc-21b0ecb9853071f0642ee1fba7861e69789d0727.tar.gz
gcc-21b0ecb9853071f0642ee1fba7861e69789d0727.tar.bz2
ada: Fix wrong finalization for call to BIP function in conditional expression
This happens when the call is a dependent expression of the conditional expression, and the conditional expression is either the expression of a simple return statement or the return expression of an expression function. The reason is that the special processing of "tail calls" for BIP functions, i.e. calls that are the expression of simple return statements or the return expression of expression functions, is not applied. This change makes sure that it is applied by distributing the simple return statements enclosing conditional expressions into the dependent expressions of the conditional expressions in almost all cases. As a side effect, this elides a temporary in the nonlimited by-reference case, as well as a pair of calls to Adjust/Finalize in the nonlimited controlled case. gcc/ada/ * exp_ch4.adb (Expand_N_Case_Expression): Distribute simple return statements enclosing the conditional expression into the dependent expressions in almost all cases. (Expand_N_If_Expression): Likewise. (Process_Transient_In_Expression): Adjust to the above distribution. * exp_ch6.adb (Expand_Ctrl_Function_Call): Deal with calls in the dependent expressions of a conditional expression. * sem_ch6.adb (Analyze_Function_Return): Deal with the rewriting of a simple return statement during the resolution of its expression.
Diffstat (limited to 'config')
0 files changed, 0 insertions, 0 deletions