Patchwork [Ada] Internal cleanup of overflow defaults

login
register
mail settings
Submitter Arnaud Charlet
Date Oct. 5, 2012, 2:32 p.m.
Message ID <20121005143213.GA11510@adacore.com>
Download mbox | patch
Permalink /patch/189498/
State New
Headers show

Comments

Arnaud Charlet - Oct. 5, 2012, 2:32 p.m.
This patch changes the default overflow checking mode to suppressed
in the case of targets that support backend divide and overflow
checking as indicated by the appropriate flags in Targparm being
set. There are no such targets currently, so this change has no
effect and no test is needed.

Tested on x86_64-pc-linux-gnu, committed on trunk

2012-10-05  Robert Dewar  <dewar@adacore.com>

	* gnat1drv.adb (Adjust_Global_Switches): Default for overflow checking
	is suppressed, even if backend overflow/divide checks are enabled.

Patch

Index: gnat1drv.adb
===================================================================
--- gnat1drv.adb	(revision 192066)
+++ gnat1drv.adb	(working copy)
@@ -328,12 +328,17 @@ 
          Exception_Mechanism := Back_End_Exceptions;
       end if;
 
-      --  Set proper status for overflow checks. If already set (by -gnato or
-      --  -gnatp) then we have nothing to do.
+      --  Set proper status for overflow checks
 
+      --  If already set (by - gnato or -gnatp) then we have nothing to do
+
       if Opt.Suppress_Options.Overflow_Checks_General /= Not_Set then
          null;
 
+      --  Otherwise set appropriate default mode. Note: at present we set
+      --  SUPPRESSED in all three of the following cases. They are separated
+      --  because in the future we may make different choices.
+
       --  By default suppress overflow checks in -gnatg mode
 
       elsif GNAT_Mode then
@@ -341,16 +346,18 @@ 
          Suppress_Options.Overflow_Checks_Assertions := Suppressed;
 
       --  If we have backend divide and overflow checks, then by default
-      --  overflow checks are minimized, which is a reasonable setting.
+      --  overflow checks are suppressed. Historically this code used to
+      --  activate overflow checks, although no target currently has these
+      --  flags set, so this was dead code anyway.
 
       elsif Targparm.Backend_Divide_Checks_On_Target
               and
             Targparm.Backend_Overflow_Checks_On_Target
       then
-         Suppress_Options.Overflow_Checks_General    := Minimized;
-         Suppress_Options.Overflow_Checks_Assertions := Minimized;
+         Suppress_Options.Overflow_Checks_General    := Suppressed;
+         Suppress_Options.Overflow_Checks_Assertions := Suppressed;
 
-      --  Otherwise for now, default is checks are suppressed. This is likely
+      --  Otherwise for now, default is checks are suppressed. This is subject
       --  to change in the future, but for now this is the compatible behavior
       --  with previous versions of GNAT.