diff options
author | Arnaud Charlet <charlet@adacore.com> | 2021-01-22 08:55:13 -0500 |
---|---|---|
committer | Pierre-Marie de Rodat <derodat@adacore.com> | 2021-05-06 03:51:42 -0400 |
commit | 369965ea43bf87a3b22610e8239f411d01daf969 (patch) | |
tree | b3df23049e881069fa5a0dbdde392e89eaebf978 | |
parent | c4aeb3c3a29a843f47bb5a207a968e2feb3b144d (diff) | |
download | gcc-369965ea43bf87a3b22610e8239f411d01daf969.zip gcc-369965ea43bf87a3b22610e8239f411d01daf969.tar.gz gcc-369965ea43bf87a3b22610e8239f411d01daf969.tar.bz2 |
[Ada] Bad expansion with -gnato2 and if expression
gcc/ada/
* exp_ch4.adb (Expand_N_If_Expression):
Apply_Arithmetic_Overflow_Check will not deal with
Then/Else_Actions so skip minimizing overflow checks if any
actions are present.
-rw-r--r-- | gcc/ada/exp_ch4.adb | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/gcc/ada/exp_ch4.adb b/gcc/ada/exp_ch4.adb index c88f791..2bcda1f 100644 --- a/gcc/ada/exp_ch4.adb +++ b/gcc/ada/exp_ch4.adb @@ -5915,9 +5915,14 @@ package body Exp_Ch4 is -- Start of processing for Expand_N_If_Expression begin - -- Check for MINIMIZED/ELIMINATED overflow mode + -- Check for MINIMIZED/ELIMINATED overflow mode. + -- Apply_Arithmetic_Overflow_Check will not deal with Then/Else_Actions + -- so skip this step if any actions are present. - if Minimized_Eliminated_Overflow_Check (N) then + if Minimized_Eliminated_Overflow_Check (N) + and then No (Then_Actions (N)) + and then No (Else_Actions (N)) + then Apply_Arithmetic_Overflow_Check (N); return; end if; |