[Bug c++/113674] [11/12/13/14 Regression] [[____attr____]] causes internal compiler error: in decl_attributes, at attribs.cc:776
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113674 --- Comment #7 from GCC Commits --- The master branch has been updated by Jakub Jelinek : https://gcc.gnu.org/g:b42e978f29b33071addff6d7bb8bcdb11d176606 commit r14-8940-gb42e978f29b33071addff6d7bb8bcdb11d176606 Author: Jakub Jelinek Date: Mon Feb 12 20:45:01 2024 +0100 attribs: Don't canonicalize lookup_scoped_attribute_spec argument [PR113674] The C and C++ FEs when parsing attributes already canonicalize them (i.e. if they start with __ and end with __ substrings, we remove those). lookup_attribute already verifies in gcc_assert that the first character of name is not an underscore, and even lookup_scoped_attribute_spec doesn't attempt to canonicalize the namespace it is passed. But for some historic reason it was canonicalizing the name argument, which misbehaves when an attribute starts with and ends with . I believe it is just wrong to try to canonicalize lookup_scope_attribute_spec name attribute, it should have been canonicalized already, in other spots where it is called it is already canonicalized before. 2024-02-12 Jakub Jelinek PR c++/113674 * attribs.cc (extract_attribute_substring): Remove. (lookup_scoped_attribute_spec): Don't call it. * c-c++-common/Wattributes-3.c: New test.
[Bug c++/113674] [11/12/13/14 Regression] [[____attr____]] causes internal compiler error: in decl_attributes, at attribs.cc:776
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113674 Jakub Jelinek changed: What|Removed |Added Assignee|unassigned at gcc dot gnu.org |jakub at gcc dot gnu.org Status|NEW |ASSIGNED --- Comment #6 from Jakub Jelinek --- Created attachment 57394 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=57394=edit gcc14-pr113674.patch Untested fix.
[Bug c++/113674] [11/12/13/14 Regression] [[____attr____]] causes internal compiler error: in decl_attributes, at attribs.cc:776
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113674 --- Comment #5 from Joseph S. Myers --- C supports _Noreturn (and thus ___Noreturn__) as an attribute name, so that code with "#define noreturn _Noreturn" (probably from stdnoreturn.h) works with C23 [[noreturn]].
[Bug c++/113674] [11/12/13/14 Regression] [[____attr____]] causes internal compiler error: in decl_attributes, at attribs.cc:776
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113674 --- Comment #4 from Marek Polacek --- Note that [[pure]] int g (int i) { return i; } doesn't crash: pure isn't a standard attribute. The crash seems to occur only with an attribute that is registered twice: the GNU version and the standard version.
[Bug c++/113674] [11/12/13/14 Regression] [[____attr____]] causes internal compiler error: in decl_attributes, at attribs.cc:776
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113674 Jakub Jelinek changed: What|Removed |Added CC||jakub at gcc dot gnu.org --- Comment #3 from Jakub Jelinek --- Maybe we shouldn't canonicalize attribute names like this, because they can be then canonicalized multiple times, each time removing the __ and __ pair from it and so could lead to inconsistencies. Now, no standard nor supported attribute name starts with _, so perhaps it could be even just punt if it is prefixed with ___ instead of __ (though, guess one can use -Wno-attributes=something::_foo ).
[Bug c++/113674] [11/12/13/14 Regression] [[____attr____]] causes internal compiler error: in decl_attributes, at attribs.cc:776
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113674 --- Comment #2 from Marek Polacek --- [[maybe_unused]] int g (int i) { return i; } crashes in cc1plus since r8-2418-g577eec56569258 which is probably the real culprit: commit 577eec5656925889d99c658de2a54ba8bd3ebf79 Author: Martin Liska Date: Mon Aug 7 10:37:07 2017 +0200 Canonicalize names of attributes.
[Bug c++/113674] [11/12/13/14 Regression] [[____attr____]] causes internal compiler error: in decl_attributes, at attribs.cc:776
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113674 Richard Biener changed: What|Removed |Added Ever confirmed|0 |1 Status|UNCONFIRMED |NEW Last reconfirmed||2024-01-31
[Bug c++/113674] [11/12/13/14 Regression] [[____attr____]] causes internal compiler error: in decl_attributes, at attribs.cc:776
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113674 Marek Polacek changed: What|Removed |Added Summary|[[attr]] causes |[11/12/13/14 Regression] |internal compiler error: in |[[attr]] causes |decl_attributes, at |internal compiler error: in |attribs.cc:776 |decl_attributes, at ||attribs.cc:776 Keywords||ice-on-valid-code Priority|P3 |P2 Target Milestone|--- |11.5 --- Comment #1 from Marek Polacek --- g++9: q.C:2:9: warning: ‘__noreturn__’ attribute directive ignored [-Wattributes] 2 | g (int i) | ^ Caused by my r10-1214-g1bf32c1141e230 I think: commit 1bf32c1141e230743f9248f7f7bf8aab91823df5 Author: Marek Polacek Date: Wed Jun 19 21:27:45 2019 + PR c++/60364 - noreturn after first decl not diagnosed. Marking as ICE-on-valid because we should just ignore the attribute.