]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
PR tree-optimization/92115
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 17 Oct 2019 07:20:36 +0000 (07:20 +0000)
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 17 Oct 2019 07:20:36 +0000 (07:20 +0000)
* tree-ssa-ifcombine.c (ifcombine_ifandif): Force condition into
temporary if it could trap.

* gcc.dg/pr92115.c: New test.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@277092 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/pr92115.c [new file with mode: 0644]
gcc/tree-ssa-ifcombine.c

index afe0d29f6e16b77e802e528c5d78de4ce79d0af2..5fccbd4d1d8802f2c263214e531969baedd1ccc3 100644 (file)
@@ -1,3 +1,9 @@
+2019-10-17  Jakub Jelinek  <jakub@redhat.com>
+
+       PR tree-optimization/92115
+       * tree-ssa-ifcombine.c (ifcombine_ifandif): Force condition into
+       temporary if it could trap.
+
 2019-10-17  Richard Biener  <rguenther@suse.de>
 
        PR debug/91887
index e23272ae4566e35974004d8108e34bb8b68b2b17..c79ba7b989a168ffe53cd4b01fa25d0b463e7fc6 100644 (file)
@@ -1,5 +1,8 @@
 2019-10-17  Jakub Jelinek  <jakub@redhat.com>
 
+       PR tree-optimization/92115
+       * gcc.dg/pr92115.c: New test.
+
        PR fortran/87752
        * gfortran.dg/gomp/pr87752.f90: New test.
 
diff --git a/gcc/testsuite/gcc.dg/pr92115.c b/gcc/testsuite/gcc.dg/pr92115.c
new file mode 100644 (file)
index 0000000..ae506d4
--- /dev/null
@@ -0,0 +1,10 @@
+/* PR tree-optimization/92115 */
+/* { dg-do compile } */
+/* { dg-options "-O1 -fexceptions -ffinite-math-only -fnon-call-exceptions -fsignaling-nans -fno-signed-zeros" } */
+
+void
+foo (double x)
+{
+  if (x == 0.0 && !__builtin_signbit (x))
+    __builtin_abort ();
+}
index 90d8bb5e9e76ad88eddb9645258d7e5630c8132b..21c1b0e8918219252740a10b83d99dc4da05fb08 100644 (file)
@@ -599,6 +599,12 @@ ifcombine_ifandif (basic_block inner_cond_bb, bool inner_inv,
       t = canonicalize_cond_expr_cond (t);
       if (!t)
        return false;
+      if (!is_gimple_condexpr_for_cond (t))
+       {
+         gsi = gsi_for_stmt (inner_cond);
+         t = force_gimple_operand_gsi_1 (&gsi, t, is_gimple_condexpr_for_cond,
+                                         NULL, true, GSI_SAME_STMT);
+       }
       gimple_cond_set_condition_from_tree (inner_cond, t);
       update_stmt (inner_cond);