This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Fix PR ipa/65282


Hello.

There's suggested patch for the issue, where regression test have been running on x86_64-linux-pc.

Ready for trunk after tests will be finished?
Thanks,
Martin
>From a186fc97c5f192b94cc571f611a50eb0f4f8a354 Mon Sep 17 00:00:00 2001
From: mliska <mliska@suse.cz>
Date: Tue, 3 Mar 2015 11:33:30 +0100
Subject: [PATCH] Fix PR ipa/65282.

gcc/testsuite/ChangeLog:

2015-03-03  Martin Liska  <mliska@suse.cz>

	* gcc.dg/ipa/PR65282.c: New test.

gcc/ChangeLog:

2015-03-03  Martin Liska  <mliska@suse.cz>

	PR ipa/65282
	* ipa-icf.c (sem_variable::equals): Fix wrong condition.
---
 gcc/ipa-icf.c                      |  2 +-
 gcc/testsuite/gcc.dg/ipa/PR65282.c | 20 ++++++++++++++++++++
 2 files changed, 21 insertions(+), 1 deletion(-)
 create mode 100644 gcc/testsuite/gcc.dg/ipa/PR65282.c

diff --git a/gcc/ipa-icf.c b/gcc/ipa-icf.c
index 14ccea5..08ee979 100644
--- a/gcc/ipa-icf.c
+++ b/gcc/ipa-icf.c
@@ -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)))
diff --git a/gcc/testsuite/gcc.dg/ipa/PR65282.c b/gcc/testsuite/gcc.dg/ipa/PR65282.c
new file mode 100644
index 0000000..58e1c55
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ipa/PR65282.c
@@ -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" } } */
-- 
2.1.2


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]