public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r13-489] [Ada] Handle case-expression inside if-expression in -gnato2
@ 2022-05-16  8:44 Pierre-Marie de Rodat
  0 siblings, 0 replies; only message in thread
From: Pierre-Marie de Rodat @ 2022-05-16  8:44 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:ae745a0de34892d0d1e7157292628c375a94221f

commit r13-489-gae745a0de34892d0d1e7157292628c375a94221f
Author: Etienne Servais <servais@adacore.com>
Date:   Tue Mar 8 14:49:55 2022 +0100

    [Ada] Handle case-expression inside if-expression in -gnato2
    
    gcc/ada/
    
            * checks.adb (Apply_Arithmetic_Overflow_Minimized_Eliminated):
            Fix condition to return.

Diff:
---
 gcc/ada/checks.adb | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/gcc/ada/checks.adb b/gcc/ada/checks.adb
index 9950c18347c..14f4f95f88c 100644
--- a/gcc/ada/checks.adb
+++ b/gcc/ada/checks.adb
@@ -1237,11 +1237,16 @@ package body Checks is
          --  ops, but if they appear in an assignment or similar contexts
          --  there is no overflow check that starts from that parent node,
          --  so apply check now.
+         --  Similarly, if these expressions are nested, we should go on.
 
          if Nkind (P) in N_If_Expression | N_Case_Expression
            and then not Is_Signed_Integer_Arithmetic_Op (Parent (P))
          then
             null;
+         elsif Nkind (P) in N_If_Expression | N_Case_Expression
+            and then Nkind (Op) in N_If_Expression | N_Case_Expression
+         then
+            null;
          else
             return;
          end if;


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

only message in thread, other threads:[~2022-05-16  8:44 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-16  8:44 [gcc r13-489] [Ada] Handle case-expression inside if-expression in -gnato2 Pierre-Marie de Rodat

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).