summaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2016-03-09 21:05:40 +0100
committerJakub Jelinek <jakub@gcc.gnu.org>2016-03-09 21:05:40 +0100
commit2bd8090ff56fdf1ca9ed76a9668a30f4e7d8f949 (patch)
treef35508be294e118a3e7415d51eb9fb7035a843fa /gcc
parent96b3c82df1fffef2f30045d571589be8d866aaf4 (diff)
downloadgcc-2bd8090ff56fdf1ca9ed76a9668a30f4e7d8f949.tar.gz
re PR middle-end/70127 (wrong code on x86_64-linux-gnu at -O3 in 32-bit and 64-bit modes)
PR tree-optimization/70127 * fold-const.c (operand_equal_p): Revert the 2015-10-28 change. * gcc.c-torture/execute/pr70127.c: New test. From-SVN: r234090
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/fold-const.c3
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/pr70127.c23
4 files changed, 36 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index d3323a62a8a..1f91bb11053 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2016-03-08 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/70127
+ * fold-const.c (operand_equal_p): Revert the 2015-10-28 change.
+
2016-03-09 David Malcolm <dmalcolm@redhat.com>
PR c/68473
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index 21241db5a49..696b4a6996f 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -3032,6 +3032,9 @@ operand_equal_p (const_tree arg0, const_tree arg1, unsigned int flags)
TYPE_SIZE (TREE_TYPE (arg1)),
flags)))
return 0;
+ /* Verify that access happens in similar types. */
+ if (!types_compatible_p (TREE_TYPE (arg0), TREE_TYPE (arg1)))
+ return 0;
/* Verify that accesses are TBAA compatible. */
if (!alias_ptr_types_compatible_p
(TREE_TYPE (TREE_OPERAND (arg0, 1)),
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 31dd65e20b7..e611b29be0f 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2016-03-08 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/70127
+ * gcc.c-torture/execute/pr70127.c: New test.
+
2016-03-09 Cesar Philippidis <cesar@codesourcery.com>
* c-c++-common/goacc/combined-directives-2.c: New test.
diff --git a/gcc/testsuite/gcc.c-torture/execute/pr70127.c b/gcc/testsuite/gcc.c-torture/execute/pr70127.c
new file mode 100644
index 00000000000..a0bf3c02830
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/pr70127.c
@@ -0,0 +1,23 @@
+/* PR tree-optimization/70127 */
+
+struct S { int f; signed int g : 2; } a[1], c = {5, 1}, d;
+short b;
+
+__attribute__((noinline, noclone)) void
+foo (int x)
+{
+ if (x != 1)
+ __builtin_abort ();
+}
+
+int
+main ()
+{
+ while (b++ <= 0)
+ {
+ struct S e = {1, 1};
+ d = e = a[0] = c;
+ }
+ foo (a[0].g);
+ return 0;
+}