re PR ipa/65282 (wrong code at -Os and above on x86_64-linux-gnu)
authorMartin Liska <mliska@suse.cz>
Tue, 3 Mar 2015 12:09:13 +0000 (13:09 +0100)
committerMartin Liska <marxin@gcc.gnu.org>
Tue, 3 Mar 2015 12:09:13 +0000 (12:09 +0000)
Fix PR ipa/65282.

* gcc.dg/ipa/PR65282.c: New test.
PR ipa/65282
* ipa-icf.c (sem_variable::equals): Fix wrong condition.

From-SVN: r221146

gcc/ChangeLog
gcc/ipa-icf.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/ipa/PR65282.c [new file with mode: 0644]

index cb42917f6104aa86179b1f886a23d1ab614d5f46..f2fd1ff6ffb8a287fb07377a1d68b3f6976518fb 100644 (file)
@@ -1,3 +1,8 @@
+2015-03-03  Martin Liska  <mliska@suse.cz>
+
+       PR ipa/65282
+       * ipa-icf.c (sem_variable::equals): Fix wrong condition.
+
 2015-03-23  Jeff Law  <law@redhat.com>
 
        PR tree-optimization/65241
index 48326185d9607790ec9e39f024f16a066946402a..a47ca29aeea05216488ee92aa76b98c021f9927f 100644 (file)
@@ -1638,7 +1638,7 @@ sem_variable::equals (tree t1, tree t2)
        tree y1 = TREE_OPERAND (t1, 1);
        tree y2 = TREE_OPERAND (t2, 1);
 
-       if (!sem_variable::equals (x1, x2) && sem_variable::equals (y1, y2))
+       if (!sem_variable::equals (x1, x2) || !sem_variable::equals (y1, y2))
          return false;
        if (!sem_variable::equals (array_ref_low_bound (t1),
                                   array_ref_low_bound (t2)))
index 824d2561fea38bfbf1afd357ab275a5dc3b46305..11ffd258d6179b10ac2833f856f250bddaac1723 100644 (file)
@@ -1,3 +1,7 @@
+2015-03-03  Martin Liska  <mliska@suse.cz>
+
+       * gcc.dg/ipa/PR65282.c: New test.
+
 2015-03-13  Jeff Law  <law@redhat.com>
 
        PR tree-optimization/65241
diff --git a/gcc/testsuite/gcc.dg/ipa/PR65282.c b/gcc/testsuite/gcc.dg/ipa/PR65282.c
new file mode 100644 (file)
index 0000000..58e1c55
--- /dev/null
@@ -0,0 +1,20 @@
+/* { dg-do compile } */
+/* { dg-options "-Os -fdump-ipa-icf"  } */
+
+int a[2];
+static int *b = &a[0], *c = &a[1];
+
+int
+main ()
+{
+  *c = 1;
+  *b = 0;
+
+  if (a[1] != 1)
+    __builtin_abort ();
+
+  return 0;
+}
+
+/* { dg-final { scan-ipa-dump "Equal symbols: 0" "icf"  } } */
+/* { dg-final { cleanup-ipa-dump "icf" } } */