re PR middle-end/67512 (internal compiler error: in invert_tree_comparison, at fold...
authorMarek Polacek <polacek@redhat.com>
Wed, 9 Sep 2015 17:09:32 +0000 (17:09 +0000)
committerMarek Polacek <mpolacek@gcc.gnu.org>
Wed, 9 Sep 2015 17:09:32 +0000 (17:09 +0000)
PR middle-end/67512
* tree-ssa-uninit.c (pred_equal_p): Only call invert_tree_comparison
for comparisons.

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

From-SVN: r227594

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

index 44bf040fe513ffc91ee205562f5ad5f8afba6fb7..5b5f9b681c73de279d600cfafd17cc4cbf67bb14 100644 (file)
@@ -1,3 +1,9 @@
+2015-09-09  Marek Polacek  <polacek@redhat.com>
+
+       PR middle-end/67512
+       * tree-ssa-uninit.c (pred_equal_p): Only call invert_tree_comparison
+       for comparisons.
+
 2015-09-09  Paolo Carlini  <paolo.carlini@oracle.com>
 
        PR c++/53184
index 8215fbea23f23e7622a6d9bfa7f133a11b2dd4ef..dbf06c64a15297f9aef5e39bb8af7fbdc8cbf213 100644 (file)
@@ -1,3 +1,8 @@
+2015-09-09  Marek Polacek  <polacek@redhat.com>
+
+       PR middle-end/67512
+       * gcc.dg/pr67512.c: New test.
+
 2015-09-09  Paolo Carlini  <paolo.carlini@oracle.com>
 
        PR c++/53184
diff --git a/gcc/testsuite/gcc.dg/pr67512.c b/gcc/testsuite/gcc.dg/pr67512.c
new file mode 100644 (file)
index 0000000..95f836a
--- /dev/null
@@ -0,0 +1,15 @@
+/* PR middle-end/67512 */
+/* { dg-do compile }  */
+/* { dg-options "-O -Wuninitialized" } */
+
+extern int fn2 (void);
+extern int fn3 (int);
+void
+fn1 (void)
+{
+  int z, m;
+  if (1 & m) /* { dg-warning "is used uninitialized" } */
+    z = fn2 ();
+  z = 1 == m ? z : 2 == m;
+  fn3 (z);
+}
index ec6d6f5a747e3356ab1cdf99509fba159433589b..fa59642d5a6f9d2dc5fe085252106b4410e43474 100644 (file)
@@ -1296,7 +1296,8 @@ pred_equal_p (pred_info x1, pred_info x2)
     return false;
 
   c1 = x1.cond_code;
-  if (x1.invert != x2.invert)
+  if (x1.invert != x2.invert
+      && TREE_CODE_CLASS (x2.cond_code) == tcc_comparison)
     c2 = invert_tree_comparison (x2.cond_code, false);
   else
     c2 = x2.cond_code;