* [Ada] Bad expansion with -gnato2 and if expression
@ 2021-05-06 7:58 Pierre-Marie de Rodat
0 siblings, 0 replies; only message in thread
From: Pierre-Marie de Rodat @ 2021-05-06 7:58 UTC (permalink / raw)
To: gcc-patches; +Cc: Arnaud Charlet
[-- Attachment #1: Type: text/plain, Size: 337 bytes --]
When dealing with -gnato2 inside an if expression, we might drop on the
floor the If or Else_Nodes.
Tested on x86_64-pc-linux-gnu, committed on trunk
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.
[-- Attachment #2: patch.diff --]
[-- Type: text/x-diff, Size: 752 bytes --]
diff --git a/gcc/ada/exp_ch4.adb b/gcc/ada/exp_ch4.adb
--- 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;
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-05-06 7:58 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-06 7:58 [Ada] Bad expansion with -gnato2 and if expression 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).