]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
PR tree-optimization/70127
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 9 Mar 2016 20:05:40 +0000 (20:05 +0000)
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 9 Mar 2016 20:05:40 +0000 (20:05 +0000)
* fold-const.c (operand_equal_p): Revert the 2015-10-28 change.

* gcc.c-torture/execute/pr70127.c: New test.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@234090 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/fold-const.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.c-torture/execute/pr70127.c [new file with mode: 0644]

index d3323a62a8a51cf113c54493cb4a49fd4c2bf8a8..1f91bb11053128d81ffd50d61dd0a8f4bfb06e10 100644 (file)
@@ -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
index 21241db5a49c566924a98b59a886e173d496d609..696b4a6996fa735d9bd794549f6cf668a34a1775 100644 (file)
@@ -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)),
index 31dd65e20b7f178339b7b8204824a58a755fe78e..e611b29be0f3446911cc6c70705b38a807aab2e1 100644 (file)
@@ -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 (file)
index 0000000..a0bf3c0
--- /dev/null
@@ -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;
+}