> Tested on x86_64-suse-linux, applied on the mainline, 8 and 7 branches.
>
>
> 2018-11-08 Eric Botcazou <ebotca...@adacore.com>
>
> * fe.h (Suppress_Checks): Declare.
> * gcc-interface/misc.c (gnat_init_gcc_eh): Set -fnon-call-exceptions
> only if checks are not suppressed and -faggressive-loop-optimizations
> only if they are.
> * gcc-interface/trans.c (struct loop_info_d): Remove has_checks and
> warned_aggressive_loop_optimizations fields.
> (gigi): Do not clear warn_aggressive_loop_optimizations here.
> (Raise_Error_to_gnu): Do not set has_checks.
> (gnat_to_gnu) <N_Indexed_Component>: Remove support for aggressive
> loop optimizations.
The following small adjustment is needed on some platforms. Applied.
* gcc-interface/misc.c (gnat_init_gcc_eh): Set -fnon-call-exceptions
for the runtime on platforms where System.Machine_Overflow is true.
--
Eric Botcazou
Index: gcc-interface/misc.c
===================================================================
--- gcc-interface/misc.c (revision 266029)
+++ gcc-interface/misc.c (working copy)
@@ -405,10 +405,15 @@ gnat_init_gcc_eh (void)
as permitted in Ada.
Turn off -faggressive-loop-optimizations because it may optimize away
out-of-bound array accesses that we want to be able to catch.
- If checks are disabled, we use the same settings as the C++ compiler. */
+ If checks are disabled, we use the same settings as the C++ compiler,
+ except for the runtime on platforms where S'Machine_Overflow is true
+ because the runtime depends on FP (hardware) checks being properly
+ handled despite being compiled in -gnatp mode. */
flag_exceptions = 1;
flag_delete_dead_exceptions = 1;
- if (!Suppress_Checks)
+ if (Suppress_Checks)
+ flag_non_call_exceptions = Machine_Overflows_On_Target && GNAT_Mode;
+ else
{
flag_non_call_exceptions = 1;
flag_aggressive_loop_optimizations = 0;