re PR tree-optimization/80374 (ICE in fold_convert_loc, at fold-const.c:2384)
authorJeff Law <law@redhat.com>
Mon, 10 Apr 2017 19:19:42 +0000 (13:19 -0600)
committerJeff Law <law@gcc.gnu.org>
Mon, 10 Apr 2017 19:19:42 +0000 (13:19 -0600)
PR tree-optimization/80374
* tree-ssa-dom.c (derive_equivalences_from_bit_ior): Do not try to
record anything if we can not convert integer_zero_node to the
desired type.

PR tree-optimization/80374
* g++.dg/pr80374.c: New test.

From-SVN: r246819

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/pr80374.C [new file with mode: 0644]
gcc/tree-ssa-dom.c

index 1a22bc037d4f239b1387b8d7cf04278bc5c0c013..9f46d13b0328c158e684827735ae2482fadd8c5c 100644 (file)
@@ -1,3 +1,10 @@
+2017-04-10  Jeff Law  <law@redhat.com>
+
+       PR tree-optimization/80374
+       * tree-ssa-dom.c (derive_equivalences_from_bit_ior): Do not try to
+       record anything if we can not convert integer_zero_node to the
+       desired type.
+
 2017-04-10  Kelvin Nilsen  <kelvin@gcc.gnu.org>
 
        PR target/80108
index de2de1c8f2cf1d664b305a9e0710ff08b4163aed..4787f0af7c4689d7b8c7527e752f34c1c310a315 100644 (file)
@@ -1,3 +1,8 @@
+2017-04-10  Jeff Law  <law@redhat.com>
+
+       PR tree-optimization/80374
+       * g++.dg/pr80374.c: New test.
+
 2017-04-10  Kelvin Nilsen  <kelvin@gcc.gnu.org>
 
        PR target/80108
diff --git a/gcc/testsuite/g++.dg/pr80374.C b/gcc/testsuite/g++.dg/pr80374.C
new file mode 100644 (file)
index 0000000..b02b656
--- /dev/null
@@ -0,0 +1,19 @@
+void a (const char *, const char *, int, const char *)
+  __attribute__ ((__noreturn__));
+template <typename b, int>
+void
+c () try
+  {
+    throw;
+  }
+catch (b d)
+  {
+    if (d)
+      a ("", "", 2, __PRETTY_FUNCTION__);
+  }
+main ()
+{
+  using e = decltype (nullptr);
+  c<volatile e, true> ();
+}
+
index d2263bb13e698c41ca7262972f3b2b45a00b2c90..d9e5942206b13ee1a124fcea6c8117bce0f93237 100644 (file)
@@ -701,7 +701,8 @@ derive_equivalences_from_bit_ior (tree name,
                                  const_and_copies *const_and_copies,
                                  int recursion_limit)
 {
-  if (recursion_limit == 0)
+  if (recursion_limit == 0
+      || !fold_convertible_p (TREE_TYPE (name), integer_zero_node))
     return;
 
   if (TREE_CODE (name) == SSA_NAME)