From: Etienne Servais Date: Tue, 8 Mar 2022 13:49:55 +0000 (+0100) Subject: [Ada] Handle case-expression inside if-expression in -gnato2 X-Git-Tag: basepoints/gcc-14~6718 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ae745a0de34892d0d1e7157292628c375a94221f;p=thirdparty%2Fgcc.git [Ada] Handle case-expression inside if-expression in -gnato2 gcc/ada/ * checks.adb (Apply_Arithmetic_Overflow_Minimized_Eliminated): Fix condition to return. --- 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;