https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87843
--- Comment #14 from Richard Biener <rguenth at gcc dot gnu.org> ---
The following does _not_ fix it (but an assert that the alias-set is -1 does
trigger). We probably have to adjust all types the record parent is embedded
into as well for which there's no easy way.
Well. Not compute any alias-sets before free-lang-data .... -Wstrict-aliasing
computes it for example, so does folding, for example in make_bit_field_ref
(in fact that seems to be the only caller...).
diff --git a/gcc/tree.c b/gcc/tree.c
index 069d62d51be..47cbbaab9b5 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -5515,7 +5515,10 @@ free_lang_data_in_decl (tree decl, struct
free_lang_data_d *fld)
}
else if (TREE_CODE (decl) == FIELD_DECL)
{
+ tree orig = TREE_TYPE (decl);
TREE_TYPE (decl) = fld_simplified_type (TREE_TYPE (decl), fld);
+ if (TREE_TYPE (decl) != orig)
+ TYPE_ALIAS_SET (DECL_CONTEXT (decl)) = -1;
DECL_INITIAL (decl) = NULL_TREE;
}
else if (TREE_CODE (decl) == TRANSLATION_UNIT_DECL