re PR tree-optimization/88621 (wrong code at -O1 and above on x86_64-linux-gnu in...
authorRichard Biener <rguenther@suse.de>
Wed, 2 Jan 2019 12:19:10 +0000 (12:19 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Wed, 2 Jan 2019 12:19:10 +0000 (12:19 +0000)
2019-01-02  Richard Biener  <rguenther@suse.de>

PR tree-optimization/88621
* tree-ssa-loop-im.c (gather_mem_refs_stmt): Fix pastos, avoid
bitfields when canoncalizing.

* gcc.dg/torture/pr88621.c: New testcase.

From-SVN: r267510

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/torture/pr88621.c [new file with mode: 0644]
gcc/tree-ssa-loop-im.c

index 37c318da6a0e595dab04a1849e103d0219a993d6..1c86e22a777b54be76ae4e7543c2b83269244785 100644 (file)
@@ -1,3 +1,9 @@
+2019-01-02  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/88621
+       * tree-ssa-loop-im.c (gather_mem_refs_stmt): Fix pastos, avoid
+       bitfields when canoncalizing.
+
 2019-01-02  Richard Biener  <rguenther@suse.de>
 
        PR target/87545
index dfb1c97b61ed98125cc053ecf4818f0e691dea19..51ecc5380a6ec21a632cd00f8dde45fdaaa6e181 100644 (file)
@@ -1,3 +1,8 @@
+2019-01-02  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/88621
+       * gcc.dg/torture/pr88621.c: New testcase.
+
 2019-01-02  Jakub Jelinek  <jakub@redhat.com>
 
        PR ipa/88561
diff --git a/gcc/testsuite/gcc.dg/torture/pr88621.c b/gcc/testsuite/gcc.dg/torture/pr88621.c
new file mode 100644 (file)
index 0000000..78492a3
--- /dev/null
@@ -0,0 +1,25 @@
+/* { dg-do run } */
+
+struct S
+{
+  int b:4;
+  int c; 
+} e = { -1, 0 };
+
+int d, f;
+
+int main ()
+{
+  while (f)
+    {
+      struct S g = { 0, 0 };
+      e = g;
+    }
+L:
+  while (e.b > 0)
+    ;
+  e.b = 0;
+  if (d)
+    goto L;
+  return 0;
+}
index 58da79d0545602d14e6fe1ab0dc7d00426a906dc..0919931cec3008fa4425e0065472d2218be53c28 100644 (file)
@@ -1468,9 +1468,10 @@ gather_mem_refs_stmt (struct loop *loop, gimple *stmt)
       tree mem_base;
       if (aor.max_size_known_p ()
          && aor.offset.is_constant (&offset)
-         && aor.offset.is_constant (&size)
-         && aor.offset.is_constant (&max_size)
+         && aor.size.is_constant (&size)
+         && aor.max_size.is_constant (&max_size)
          && size == max_size
+         && (size % BITS_PER_UNIT) == 0
          && (mem_base = get_addr_base_and_unit_offset (aor.ref, &mem_off)))
        {
          hash = iterative_hash_expr (ao_ref_base (&aor), 0);