[Bug c++/70512] [6 Regression] ICE on valid code on x86_64-linux-gnu: canonical types differ for identical types
mpolacek at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Mon Apr 4 17:54:00 GMT 2016
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70512
Marek Polacek <mpolacek at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |mpolacek at gcc dot gnu.org
--- Comment #2 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Jakub's testcase points to the issue here: in the original testcase, when we
parse the member declaration (operator=), we create a method with type struct
S, but because we haven't yet parsed the trailing attribute, the type doesn't
have any attributes, thus
7925 /* If the pointed-to type has the may_alias attribute set, force
7926 a TYPE_REF_CAN_ALIAS_ALL pointer to be generated. */
7927 if (lookup_attribute ("may_alias", TYPE_ATTRIBUTES (to_type)))
7928 can_alias_all = true;
in build_pointer_type_for_mode doesn't trigger. Some time after that we parse
the trailing attribute:
21318 /* Look for trailing attributes to apply to this class. */
21319 if (cp_parser_allow_gnu_extensions_p (parser))
21320 attributes = cp_parser_gnu_attributes_opt (parser);
And then we somehow arrive at finish_return_stmt -- and that will try to
convert 'this' to 'struct S', so it calls build_pointer_type again, but this
time we see the attribute and thus set TYPE_REF_CAN_ALIAS_ALL.
More information about the Gcc-bugs
mailing list