diff options
author | Eric Botcazou <ebotcazou@adacore.com> | 2017-07-16 22:03:54 +0000 |
---|---|---|
committer | Eric Botcazou <ebotcazou@gcc.gnu.org> | 2017-07-16 22:03:54 +0000 |
commit | 38f638cae20c53258854054bfc09f489c01ffe94 (patch) | |
tree | c49cf2dcd3b1df898c4e6bcf2bd73d2babd4798c /gcc | |
parent | 1234ee19c9a7b175c154f987d3089d669d17501a (diff) | |
download | gcc-38f638cae20c53258854054bfc09f489c01ffe94.zip gcc-38f638cae20c53258854054bfc09f489c01ffe94.tar.gz gcc-38f638cae20c53258854054bfc09f489c01ffe94.tar.bz2 |
re PR rtl-optimization/81424 (internal error on GPRbuild with -O2)
PR rtl-optimization/81424
* optabs.c (prepare_cmp_insn): Use copy_to_reg instead of force_reg
to remove potential trapping from operands if -fnon-call-exceptions.
From-SVN: r250246
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/optabs.c | 4 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/testsuite/gnat.dg/opt65.adb | 30 |
4 files changed, 42 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 31979ed..240ff40 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2017-07-16 Eric Botcazou <ebotcazou@adacore.com> + + PR rtl-optimization/81424 + * optabs.c (prepare_cmp_insn): Use copy_to_reg instead of force_reg + to remove potential trapping from operands if -fnon-call-exceptions. + 2017-07-16 Jan Hubicka <hubicka@ucw.cz> * tree-ssa-loop-manip.c (tree_transform_and_unroll_loop): Use diff --git a/gcc/optabs.c b/gcc/optabs.c index 3905132..9258e5f 100644 --- a/gcc/optabs.c +++ b/gcc/optabs.c @@ -3846,9 +3846,9 @@ prepare_cmp_insn (rtx x, rtx y, enum rtx_code comparison, rtx size, if (cfun->can_throw_non_call_exceptions) { if (may_trap_p (x)) - x = force_reg (mode, x); + x = copy_to_reg (x); if (may_trap_p (y)) - y = force_reg (mode, y); + y = copy_to_reg (y); } if (GET_MODE_CLASS (mode) == MODE_CC) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 3ede9d8..872d24e 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2017-07-16 Eric Botcazou <ebotcazou@adacore.com> + + * gnat.dg/opt65.adb: New test. + 2017-07-16 Jan Hubicka <hubicka@ucw.cz> * gcc.dg/predict-8.c: Update. diff --git a/gcc/testsuite/gnat.dg/opt65.adb b/gcc/testsuite/gnat.dg/opt65.adb new file mode 100644 index 0000000..7b429b6 --- /dev/null +++ b/gcc/testsuite/gnat.dg/opt65.adb @@ -0,0 +1,30 @@ +-- { dg-do run } +-- { dg-options "-O2" } + +with Ada.Command_Line; use Ada.Command_Line; + +procedure Opt65 is + + procedure Check_Version_And_Help (Version_String : String) is + Help_Switch_Present : Boolean := False; + Next_Arg : Natural := 1; + begin + while Next_Arg <= Argument_Count loop + declare + Next_Argv : constant String := Argument (Next_Arg); + begin + if Next_Argv = "--help" then + Help_Switch_Present := True; + end if; + Next_Arg := Next_Arg + 1; + end; + end loop; + + if Help_Switch_Present then + raise Program_Error; + end if; + end; + +begin + Check_Version_And_Help ("version"); +end; |