aboutsummaryrefslogtreecommitdiff
path: root/gcc/c
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2019-02-05 14:57:32 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2019-02-05 14:57:32 +0000
commitf461f9385df6e1b0b538d4afc7739c2ab1e207d0 (patch)
treedc5a736e2be6d449badf1a927b6ee3d9f0d4fb99 /gcc/c
parent39bc6f8752102f38d0c0ca86c02d14ee5d1d0b5f (diff)
downloadgcc-f461f9385df6e1b0b538d4afc7739c2ab1e207d0.zip
gcc-f461f9385df6e1b0b538d4afc7739c2ab1e207d0.tar.gz
gcc-f461f9385df6e1b0b538d4afc7739c2ab1e207d0.tar.bz2
re PR tree-optimization/88606 (ICE: verify_type failed (error: type variant differs by TYPE_TRANSPARENT_AGGR))
2019-02-05 Richard Biener <rguenther@suse.de> PR c/88606 * c-decl.c (finish_struct): Reset TYPE_TRANSPARENT_AGGR on all type variants when not supported. From-SVN: r268540
Diffstat (limited to 'gcc/c')
-rw-r--r--gcc/c/ChangeLog6
-rw-r--r--gcc/c/c-decl.c21
2 files changed, 17 insertions, 10 deletions
diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog
index b215758..1450d65 100644
--- a/gcc/c/ChangeLog
+++ b/gcc/c/ChangeLog
@@ -1,3 +1,9 @@
+2019-02-05 Richard Biener <rguenther@suse.de>
+
+ PR c/88606
+ * c-decl.c (finish_struct): Reset TYPE_TRANSPARENT_AGGR on
+ all type variants when not supported.
+
2019-01-30 Jakub Jelinek <jakub@redhat.com>
PR c/89061
diff --git a/gcc/c/c-decl.c b/gcc/c/c-decl.c
index 5170e92..65aee4d 100644
--- a/gcc/c/c-decl.c
+++ b/gcc/c/c-decl.c
@@ -8394,6 +8394,16 @@ finish_struct (location_t loc, tree t, tree fieldlist, tree attributes,
}
}
+ /* If this was supposed to be a transparent union, but we can't
+ make it one, warn and turn off the flag. */
+ if (TREE_CODE (t) == UNION_TYPE
+ && TYPE_TRANSPARENT_AGGR (t)
+ && (!TYPE_FIELDS (t) || TYPE_MODE (t) != DECL_MODE (TYPE_FIELDS (t))))
+ {
+ TYPE_TRANSPARENT_AGGR (t) = 0;
+ warning_at (loc, 0, "union cannot be made transparent");
+ }
+
/* Note: C_TYPE_INCOMPLETE_VARS overloads TYPE_VFIELD which is used
in dwarf2out via rest_of_decl_compilation below and means
something totally different. Since we will be clearing
@@ -8406,22 +8416,13 @@ finish_struct (location_t loc, tree t, tree fieldlist, tree attributes,
{
TYPE_FIELDS (x) = TYPE_FIELDS (t);
TYPE_LANG_SPECIFIC (x) = TYPE_LANG_SPECIFIC (t);
+ TYPE_TRANSPARENT_AGGR (x) = TYPE_TRANSPARENT_AGGR (t);
C_TYPE_FIELDS_READONLY (x) = C_TYPE_FIELDS_READONLY (t);
C_TYPE_FIELDS_VOLATILE (x) = C_TYPE_FIELDS_VOLATILE (t);
C_TYPE_VARIABLE_SIZE (x) = C_TYPE_VARIABLE_SIZE (t);
C_TYPE_INCOMPLETE_VARS (x) = NULL_TREE;
}
- /* If this was supposed to be a transparent union, but we can't
- make it one, warn and turn off the flag. */
- if (TREE_CODE (t) == UNION_TYPE
- && TYPE_TRANSPARENT_AGGR (t)
- && (!TYPE_FIELDS (t) || TYPE_MODE (t) != DECL_MODE (TYPE_FIELDS (t))))
- {
- TYPE_TRANSPARENT_AGGR (t) = 0;
- warning_at (loc, 0, "union cannot be made transparent");
- }
-
/* Update type location to the one of the definition, instead of e.g.
a forward declaration. */
if (TYPE_STUB_DECL (t))