re PR bootstrap/71816 (bootstrap broken on multiple targets)
authorRichard Biener <rguenther@suse.de>
Mon, 11 Jul 2016 13:32:51 +0000 (13:32 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Mon, 11 Jul 2016 13:32:51 +0000 (13:32 +0000)
2016-07-11  Richard Biener  <rguenther@suse.de>

PR tree-optimization/71816
* tree-ssa-pre.c (compute_avail): Adjust alignment of ref rather
than replacing all of its operands.

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

From-SVN: r238208

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/torture/pr71816.c [new file with mode: 0644]
gcc/tree-ssa-pre.c

index 0453adaf9ac6605c3f5991c88827b102602ae32b..d0dde932049ba2e1eebd9cb087fadf1f1dab60b5 100644 (file)
@@ -1,3 +1,9 @@
+2016-07-11  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/71816
+       * tree-ssa-pre.c (compute_avail): Adjust alignment of ref rather
+       than replacing all of its operands.
+
 2016-07-11  Alan Modra  <amodra@gmail.com>
 
        * config/rs6000/rs6000.md (UNSPEC_DOLOOP): New unspec.
index 63333ba01aa46bcbb10043be55b7b292465fd20a..1d9dc5b9e4447e357fbab39ebc3d9a88857da155 100644 (file)
@@ -1,3 +1,8 @@
+2016-07-11  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/71816
+       * gcc.dg/torture/pr71816.c: New testcase.
+
 2016-07-09  Thomas Koenig  <tkoenig@gcc.gnu.org>
 
        PR fortran/71783
diff --git a/gcc/testsuite/gcc.dg/torture/pr71816.c b/gcc/testsuite/gcc.dg/torture/pr71816.c
new file mode 100644 (file)
index 0000000..bdd5b1b
--- /dev/null
@@ -0,0 +1,21 @@
+/* { dg-do compile } */
+
+void *ext2fs_resize_mem_p;
+struct ext2_icount_el {
+    int ino;
+} * insert_icount_el_icount_1;
+int insert_icount_el_icount, insert_icount_el_new_size;
+void *memcpy();
+void *realloc();
+int ext2fs_resize_mem(void *p1) {
+    int size = 0;
+    memcpy(&ext2fs_resize_mem_p, p1, sizeof(ext2fs_resize_mem_p));
+    realloc(&ext2fs_resize_mem_p, size);
+    return 0;
+}
+struct ext2_icount_el *insert_icount_el() {
+    if (insert_icount_el_icount)
+      insert_icount_el_new_size = insert_icount_el_icount_1[0].ino;
+    ext2fs_resize_mem(&insert_icount_el_icount_1);
+    return 0;
+}
index 0c97f4fbcce68ffd2efb3b66f605bb58087d9888..9964c559b25d0b29e4f69a2f8d75baba34821966 100644 (file)
@@ -3791,13 +3791,9 @@ compute_avail (void)
                           || ref1->opcode == MEM_REF)
                          && (TYPE_ALIGN (ref1->type)
                              > TYPE_ALIGN (ref2->type)))
-                       {
-                         ref->operands.release ();
-                         ref->operands = operands;
-                         ref1 = ref2;
-                       }
-                     else
-                       operands.release ();
+                       ref1->type
+                         = build_aligned_type (ref1->type,
+                                               TYPE_ALIGN (ref2->type));
                      /* TBAA behavior is an obvious part so make sure
                         that the hashtable one covers this as well
                         by adjusting the ref alias set and its base.  */
@@ -3824,6 +3820,7 @@ compute_avail (void)
                            ref1->op2 = fold_convert (ptr_type_node,
                                                      ref1->op2);
                        }
+                     operands.release ();
 
                      result = pre_expr_pool.allocate ();
                      result->kind = REFERENCE;