From: Eric Botcazou Date: Wed, 5 Apr 2023 11:56:42 +0000 (+0200) Subject: ada: Fix small fallout of previous change X-Git-Tag: basepoints/gcc-15~8803 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=7c784ca077ce181bb247c6f17407da5ee0b46b0c;p=thirdparty%2Fgcc.git ada: Fix small fallout of previous change The same guard must be added to Expand_Simple_Function_Return as the one that was added to Analyze_Function_Return. gcc/ada/ * exp_ch6.adb (Expand_Simple_Function_Return): Deal with a rewriting of the simple return during the adjustment of its expression. --- diff --git a/gcc/ada/exp_ch6.adb b/gcc/ada/exp_ch6.adb index bd4f4a1412d3..87560462315e 100644 --- a/gcc/ada/exp_ch6.adb +++ b/gcc/ada/exp_ch6.adb @@ -6641,6 +6641,13 @@ package body Exp_Ch6 is if Is_Boolean_Type (Exp_Typ) and then Nonzero_Is_True (Exp_Typ) then Adjust_Condition (Exp); Adjust_Result_Type (Exp, Exp_Typ); + + -- The adjustment of the expression may have rewritten the return + -- statement itself, e.g. when it is turned into an if expression. + + if Nkind (N) /= N_Simple_Return_Statement then + return; + end if; end if; -- Do validity check if enabled for returns