re PR middle-end/79396 (ICE (verify_flow_info failed) with -fnon-call-exceptions...
authorJakub Jelinek <jakub@redhat.com>
Sat, 25 Feb 2017 10:17:31 +0000 (11:17 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Sat, 25 Feb 2017 10:17:31 +0000 (11:17 +0100)
PR middle-end/79396
* tree-eh.c (operation_could_trap_p, stmt_could_throw_1_p): Handle
FMA_EXPR like tcc_binary or tcc_unary.

* g++.dg/opt/pr79396.C: New test.

From-SVN: r245735

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/opt/pr79396.C [new file with mode: 0644]
gcc/tree-eh.c

index 04d95a35f8be827723c6dfb05db9b19a18a0e1e8..18410bc65a6f9472d8b185bb56535e93db9281a9 100644 (file)
@@ -1,5 +1,9 @@
 2017-02-25  Jakub Jelinek  <jakub@redhat.com>
 
+       PR middle-end/79396
+       * tree-eh.c (operation_could_trap_p, stmt_could_throw_1_p): Handle
+       FMA_EXPR like tcc_binary or tcc_unary.
+
        * tree-ssa-loop-niter.c (number_of_iterations_exit): Simplify warning.
 
        PR debug/77589
index 6e37ca9b5fe46fd311e3252a61c82ab32c325a30..e2850e84f88bf48507b309f8d93056f6d10627a3 100644 (file)
@@ -1,3 +1,8 @@
+2017-02-25  Jakub Jelinek  <jakub@redhat.com>
+
+       PR middle-end/79396
+       * g++.dg/opt/pr79396.C: New test.
+
 2017-02-25  Dominique d'Humieres  <dominiq@lps.ens.fr>
 
        PR fortran/79597
diff --git a/gcc/testsuite/g++.dg/opt/pr79396.C b/gcc/testsuite/g++.dg/opt/pr79396.C
new file mode 100644 (file)
index 0000000..328c271
--- /dev/null
@@ -0,0 +1,13 @@
+// PR middle-end/79396
+// { dg-do compile }
+// { dg-options "-fnon-call-exceptions -O2" }
+// { dg-additional-options "-mfma" { target i?86-*-* x86_64-*-* } }
+
+struct A { A (); ~A (); };
+
+float
+foo (float x)
+{
+  A a;
+  return __builtin_pow (x, 2) + 2;
+}
index 42fe9dfbbf8c9b2cdc76264255b111932819680d..0b785e9b314d8cfaf0f21e040a1b3079e6373fa2 100644 (file)
@@ -2513,7 +2513,8 @@ operation_could_trap_p (enum tree_code op, bool fp_operation, bool honor_trapv,
 
   if (TREE_CODE_CLASS (op) != tcc_comparison
       && TREE_CODE_CLASS (op) != tcc_unary
-      && TREE_CODE_CLASS (op) != tcc_binary)
+      && TREE_CODE_CLASS (op) != tcc_binary
+      && op != FMA_EXPR)
     return false;
 
   return operation_could_trap_helper_p (op, fp_operation, honor_trapv,
@@ -2738,7 +2739,8 @@ stmt_could_throw_1_p (gimple *stmt)
 
   if (TREE_CODE_CLASS (code) == tcc_comparison
       || TREE_CODE_CLASS (code) == tcc_unary
-      || TREE_CODE_CLASS (code) == tcc_binary)
+      || TREE_CODE_CLASS (code) == tcc_binary
+      || code == FMA_EXPR)
     {
       if (is_gimple_assign (stmt)
          && TREE_CODE_CLASS (code) == tcc_comparison)