aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEtienne Servais <servais@adacore.com>2022-03-08 14:49:55 +0100
committerPierre-Marie de Rodat <derodat@adacore.com>2022-05-16 08:42:04 +0000
commitae745a0de34892d0d1e7157292628c375a94221f (patch)
tree1a719e0137a9d2ac6ac54560c2a4454b54570928
parent7d8e3f5298608dc21757761bcab3b68365e25d1a (diff)
downloadgcc-ae745a0de34892d0d1e7157292628c375a94221f.zip
gcc-ae745a0de34892d0d1e7157292628c375a94221f.tar.gz
gcc-ae745a0de34892d0d1e7157292628c375a94221f.tar.bz2
[Ada] Handle case-expression inside if-expression in -gnato2
gcc/ada/ * checks.adb (Apply_Arithmetic_Overflow_Minimized_Eliminated): Fix condition to return.
-rw-r--r--gcc/ada/checks.adb5
1 files changed, 5 insertions, 0 deletions
diff --git a/gcc/ada/checks.adb b/gcc/ada/checks.adb
index 9950c18..14f4f95 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;