diff options
author | Arnaud Charlet <charlet@gcc.gnu.org> | 2014-07-31 14:37:03 +0200 |
---|---|---|
committer | Arnaud Charlet <charlet@gcc.gnu.org> | 2014-07-31 14:37:03 +0200 |
commit | 396eb900bbb7deb1243ea6de03fe881234314acb (patch) | |
tree | da507e16b9cb1d5024f943ccf7be402675dd61cf /gcc/ada/checks.adb | |
parent | e8cddc3b5a9c50a9c7bd4b58b97f6384bc1aa807 (diff) | |
download | gcc-396eb900bbb7deb1243ea6de03fe881234314acb.zip gcc-396eb900bbb7deb1243ea6de03fe881234314acb.tar.gz gcc-396eb900bbb7deb1243ea6de03fe881234314acb.tar.bz2 |
[multiple changes]
2014-07-31 Robert Dewar <dewar@adacore.com>
* checks.ads, checks.adb (Activate_Overflow_Check): Do not set flag for
unconstrained fpt ops.
2014-07-31 Pascal Obry <obry@adacore.com>
* s-fileio.adb (Open): Make sure a shared file gets inserted into
the global list atomically. This ensures that the file descriptor
won't be freed because another tasks is closing the file.
From-SVN: r213349
Diffstat (limited to 'gcc/ada/checks.adb')
-rw-r--r-- | gcc/ada/checks.adb | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/gcc/ada/checks.adb b/gcc/ada/checks.adb index f75f1c6..facf85b 100644 --- a/gcc/ada/checks.adb +++ b/gcc/ada/checks.adb @@ -389,10 +389,31 @@ package body Checks is procedure Activate_Overflow_Check (N : Node_Id) is begin - if not Nkind_In (N, N_Op_Rem, N_Op_Mod, N_Op_Plus) then - Set_Do_Overflow_Check (N, True); - Possible_Local_Raise (N, Standard_Constraint_Error); + -- Nothing to do for unconstrained floating-point types (the test for + -- Etype (N) being present seems necessary in some cases, should be + -- tracked down, but for now just ignore the check in this case ???) + + if Present (Etype (N)) + and then Is_Floating_Point_Type (Etype (N)) + and then not Is_Constrained (Etype (N)) + + -- But do the check after all if float overflow checking enforced + + and then not Check_Float_Overflow + then + return; + end if; + + -- Nothing to do for Rem/Mod/Plus (overflow not possible) + + if Nkind_In (N, N_Op_Rem, N_Op_Mod, N_Op_Plus) then + return; end if; + + -- Otherwise set the flag + + Set_Do_Overflow_Check (N, True); + Possible_Local_Raise (N, Standard_Constraint_Error); end Activate_Overflow_Check; -------------------------- |