[Bug c++/70512] [6 Regression] ICE on valid code on x86_64-linux-gnu: canonical types differ for identical types
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70512 Nathan Sidwell changed: What|Removed |Added Status|ASSIGNED|RESOLVED Resolution|--- |FIXED --- Comment #7 from Nathan Sidwell --- Fixed r234768.
[Bug c++/70512] [6 Regression] ICE on valid code on x86_64-linux-gnu: canonical types differ for identical types
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70512 --- Comment #6 from Nathan Sidwell --- Author: nathan Date: Tue Apr 5 23:47:21 2016 New Revision: 234768 URL: https://gcc.gnu.org/viewcvs?rev=234768=gcc=rev Log: PR c++/70512 * class.c (fixup_may_alias): New. (fixup_attribute_variants): Call it. * g++.dg/ext/attribute-may-alias-5.C: New. Added: trunk/gcc/testsuite/g++.dg/ext/attribute-may-alias-5.C Modified: trunk/gcc/cp/ChangeLog trunk/gcc/cp/class.c trunk/gcc/testsuite/ChangeLog
[Bug c++/70512] [6 Regression] ICE on valid code on x86_64-linux-gnu: canonical types differ for identical types
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70512 --- Comment #5 from Marek Polacek --- (In reply to Nathan Sidwell from comment #3) > Are you working on that? If so, please reassign this bug. I'm not currently. But I think the approach you outlines makes sense; I just didn't get round to write any code.
[Bug c++/70512] [6 Regression] ICE on valid code on x86_64-linux-gnu: canonical types differ for identical types
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70512 --- Comment #4 from Jakub Jelinek --- I'd note that we likely need to modify them in-place, as PARM_DECLs etc. with those types already will be around. for (t = TYPE_POINTER_TO (to_type); t; t = TYPE_NEXT_PTR_TO (t)) and for (t = TYPE_REFERENCE_TO (to_type); t; t = TYPE_NEXT_REF_TO (t)) walking perhaps should do it.
[Bug c++/70512] [6 Regression] ICE on valid code on x86_64-linux-gnu: canonical types differ for identical types
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70512 Nathan Sidwell changed: What|Removed |Added Status|NEW |ASSIGNED CC||nathan at gcc dot gnu.org Assignee|unassigned at gcc dot gnu.org |nathan at gcc dot gnu.org --- Comment #3 from Nathan Sidwell --- Marek, I suspected something like what you say happening, I think we then need to go through all the 'struct S' types created during the parse and modify them? Are you working on that? If so, please reassign this bug.
[Bug c++/70512] [6 Regression] ICE on valid code on x86_64-linux-gnu: canonical types differ for identical types
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70512 Marek Polacek changed: What|Removed |Added CC||mpolacek at gcc dot gnu.org --- Comment #2 from Marek Polacek --- 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.
[Bug c++/70512] [6 Regression] ICE on valid code on x86_64-linux-gnu: canonical types differ for identical types
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70512 Richard Biener changed: What|Removed |Added Priority|P3 |P1
[Bug c++/70512] [6 Regression] ICE on valid code on x86_64-linux-gnu: canonical types differ for identical types
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70512 Jakub Jelinek changed: What|Removed |Added Status|UNCONFIRMED |NEW Last reconfirmed||2016-04-04 CC||jakub at gcc dot gnu.org Target Milestone|--- |6.0 Summary|ICE on valid code on|[6 Regression] ICE on valid |x86_64-linux-gnu: canonical |code on x86_64-linux-gnu: |types differ for identical |canonical types differ for |types |identical types Ever confirmed|0 |1 --- Comment #1 from Jakub Jelinek --- Started with r222419. struct __attribute__ ((__may_alias__)) S { S& operator= (int) { return *this; } }; works properly.