re PR bootstrap/71071 (ICE --enable-checking=fold : fold check: original tree changed...
authorJakub Jelinek <jakub@redhat.com>
Fri, 13 May 2016 20:24:22 +0000 (22:24 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Fri, 13 May 2016 20:24:22 +0000 (22:24 +0200)
PR bootstrap/71071
* fold-const.c (fold_checksum_tree): Allow modification
of TYPE_ALIAS_SET during folding.

* gcc.dg/pr71071.c: New test.

From-SVN: r236222

gcc/ChangeLog
gcc/fold-const.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/pr71071.c [new file with mode: 0644]

index 1c19f925bb196ad1c863f8f4c3ed36ca27583bf5..5133b37024bd0b34133a00960b9b15040379ce3e 100644 (file)
@@ -1,5 +1,9 @@
 2016-05-13  Jakub Jelinek  <jakub@redhat.com>
 
+       PR bootstrap/71071
+       * fold-const.c (fold_checksum_tree): Allow modification
+       of TYPE_ALIAS_SET during folding.
+
        * config/i386/i386.c (ix86_compute_frame_layout, ix86_expand_prologue,
        ix86_expand_split_stack_prologue): Use HOST_WIDE_INT_C macro.
        (ix86_split_to_parts): Likewise.  Fix up formatting.
index c4346de9750fa5cacc181bdfc769911b89a5a674..8a7c93e0459b83a5a131532b9b9d39ec17e3ac74 100644 (file)
@@ -12130,7 +12130,8 @@ fold_checksum_tree (const_tree expr, struct md5_ctx *ctx,
               || TYPE_REFERENCE_TO (expr)
               || TYPE_CACHED_VALUES_P (expr)
               || TYPE_CONTAINS_PLACEHOLDER_INTERNAL (expr)
-              || TYPE_NEXT_VARIANT (expr)))
+              || TYPE_NEXT_VARIANT (expr)
+              || TYPE_ALIAS_SET_KNOWN_P (expr)))
     {
       /* Allow these fields to be modified.  */
       tree tmp;
@@ -12140,6 +12141,7 @@ fold_checksum_tree (const_tree expr, struct md5_ctx *ctx,
       TYPE_POINTER_TO (tmp) = NULL;
       TYPE_REFERENCE_TO (tmp) = NULL;
       TYPE_NEXT_VARIANT (tmp) = NULL;
+      TYPE_ALIAS_SET (tmp) = -1;
       if (TYPE_CACHED_VALUES_P (tmp))
        {
          TYPE_CACHED_VALUES_P (tmp) = 0;
index 3858cd462852b7d51ccf0de7b125b826cb7ca44e..5f3ff4d4a8a93badb1ad8c4277af465622f907c2 100644 (file)
@@ -1,3 +1,8 @@
+2016-05-13  Jakub Jelinek  <jakub@redhat.com>
+
+       PR bootstrap/71071
+       * gcc.dg/pr71071.c: New test.
+
 2016-05-13  Uros Bizjak  <ubizjak@gmail.com>
 
        * gcc.dg/vect/tree-vect.h (check_vect): Handle AVX2,
diff --git a/gcc/testsuite/gcc.dg/pr71071.c b/gcc/testsuite/gcc.dg/pr71071.c
new file mode 100644 (file)
index 0000000..582f1f1
--- /dev/null
@@ -0,0 +1,12 @@
+/* PR bootstrap/71071 */
+/* { dg-do compile } *
+/* { dg-options "-O2" } */
+
+struct S { unsigned b : 1; } a;
+
+void
+foo ()
+{
+  if (a.b)
+    ;
+}