public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r13-7869] ada: Fix small fallout of previous change
@ 2023-09-27  8:25 Eric Botcazou
  0 siblings, 0 replies; only message in thread
From: Eric Botcazou @ 2023-09-27  8:25 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:30b3c57434423ac7d89d70b80b579ba8809a7626

commit r13-7869-g30b3c57434423ac7d89d70b80b579ba8809a7626
Author: Eric Botcazou <ebotcazou@adacore.com>
Date:   Wed Apr 5 13:56:42 2023 +0200

    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:
---
 gcc/ada/exp_ch6.adb | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/gcc/ada/exp_ch6.adb b/gcc/ada/exp_ch6.adb
index 4ee6027e7cc..aee67d4546b 100644
--- a/gcc/ada/exp_ch6.adb
+++ b/gcc/ada/exp_ch6.adb
@@ -6576,6 +6576,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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-09-27  8:25 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-27  8:25 [gcc r13-7869] ada: Fix small fallout of previous change Eric Botcazou

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).