public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/113674] New: [[____attr____]] causes internal compiler error: in decl_attributes, at attribs.cc:776
@ 2024-01-30 21:44 mpolacek at gcc dot gnu.org
  2024-01-30 21:46 ` [Bug c++/113674] [11/12/13/14 Regression] " mpolacek at gcc dot gnu.org
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2024-01-30 21:44 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113674

            Bug ID: 113674
           Summary: [[____attr____]] causes internal compiler error: in
                    decl_attributes, at attribs.cc:776
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: mpolacek at gcc dot gnu.org
  Target Milestone: ---

[[____noreturn____]] int
g (int i)
{
  return i;
}

causes (both cc1 and cc1plus):

q.C:2:9: internal compiler error: in decl_attributes, at attribs.cc:776
    2 | g (int i)
      |         ^
0x1209fe5 decl_attributes(tree_node**, tree_node*, int, tree_node*)
        /home/mpolacek/src/gcc/gcc/attribs.cc:776
0xeed5cd cplus_decl_attributes(tree_node**, tree_node*, int)
        /home/mpolacek/src/gcc/gcc/cp/decl2.cc:1880
0xeb8604 grokfndecl
        /home/mpolacek/src/gcc/gcc/cp/decl.cc:10973
0xec6a60 grokdeclarator(cp_declarator const*, cp_decl_specifier_seq*,
decl_context, int, tree_node**)
        /home/mpolacek/src/gcc/gcc/cp/decl.cc:15063
0xed73ad start_function(cp_decl_specifier_seq*, cp_declarator const*,
tree_node*)
        /home/mpolacek/src/gcc/gcc/cp/decl.cc:18159
0x10563ef cp_parser_function_definition_from_specifiers_and_declarator
        /home/mpolacek/src/gcc/gcc/cp/parser.cc:32573
0x1042ac8 cp_parser_init_declarator
        /home/mpolacek/src/gcc/gcc/cp/parser.cc:23356
0x1034027 cp_parser_simple_declaration
        /home/mpolacek/src/gcc/gcc/cp/parser.cc:15890
0x1033b9d cp_parser_block_declaration
        /home/mpolacek/src/gcc/gcc/cp/parser.cc:15709
0x103379d cp_parser_declaration
        /home/mpolacek/src/gcc/gcc/cp/parser.cc:15563
0x103387d cp_parser_toplevel_declaration
        /home/mpolacek/src/gcc/gcc/cp/parser.cc:15584
0x101ac64 cp_parser_translation_unit
        /home/mpolacek/src/gcc/gcc/cp/parser.cc:5276
0x1092a8f c_parse_file()
        /home/mpolacek/src/gcc/gcc/cp/parser.cc:51174
0x12a67d8 c_common_parse_file()
        /home/mpolacek/src/gcc/gcc/c-family/c-opts.cc:1301

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug c++/113674] [11/12/13/14 Regression] [[____attr____]] causes internal compiler error: in decl_attributes, at attribs.cc:776
  2024-01-30 21:44 [Bug c++/113674] New: [[____attr____]] causes internal compiler error: in decl_attributes, at attribs.cc:776 mpolacek at gcc dot gnu.org
@ 2024-01-30 21:46 ` mpolacek at gcc dot gnu.org
  2024-01-31  8:21 ` rguenth at gcc dot gnu.org
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2024-01-30 21:46 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113674

Marek Polacek <mpolacek at gcc dot gnu.org> 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 <mpolacek at gcc dot gnu.org> ---
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 <polacek@redhat.com>
Date:   Wed Jun 19 21:27:45 2019 +0000

    PR c++/60364 - noreturn after first decl not diagnosed.


Marking as ICE-on-valid because we should just ignore the attribute.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug c++/113674] [11/12/13/14 Regression] [[____attr____]] causes internal compiler error: in decl_attributes, at attribs.cc:776
  2024-01-30 21:44 [Bug c++/113674] New: [[____attr____]] causes internal compiler error: in decl_attributes, at attribs.cc:776 mpolacek at gcc dot gnu.org
  2024-01-30 21:46 ` [Bug c++/113674] [11/12/13/14 Regression] " mpolacek at gcc dot gnu.org
@ 2024-01-31  8:21 ` rguenth at gcc dot gnu.org
  2024-01-31 16:06 ` mpolacek at gcc dot gnu.org
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu.org @ 2024-01-31  8:21 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113674

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2024-01-31

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug c++/113674] [11/12/13/14 Regression] [[____attr____]] causes internal compiler error: in decl_attributes, at attribs.cc:776
  2024-01-30 21:44 [Bug c++/113674] New: [[____attr____]] causes internal compiler error: in decl_attributes, at attribs.cc:776 mpolacek at gcc dot gnu.org
  2024-01-30 21:46 ` [Bug c++/113674] [11/12/13/14 Regression] " mpolacek at gcc dot gnu.org
  2024-01-31  8:21 ` rguenth at gcc dot gnu.org
@ 2024-01-31 16:06 ` mpolacek at gcc dot gnu.org
  2024-01-31 16:38 ` jakub at gcc dot gnu.org
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2024-01-31 16:06 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113674

--- Comment #2 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
[[____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 <mliska@suse.cz>
Date:   Mon Aug 7 10:37:07 2017 +0200

    Canonicalize names of attributes.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug c++/113674] [11/12/13/14 Regression] [[____attr____]] causes internal compiler error: in decl_attributes, at attribs.cc:776
  2024-01-30 21:44 [Bug c++/113674] New: [[____attr____]] causes internal compiler error: in decl_attributes, at attribs.cc:776 mpolacek at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2024-01-31 16:06 ` mpolacek at gcc dot gnu.org
@ 2024-01-31 16:38 ` jakub at gcc dot gnu.org
  2024-01-31 16:54 ` mpolacek at gcc dot gnu.org
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: jakub at gcc dot gnu.org @ 2024-01-31 16:38 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113674

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
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 ).

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug c++/113674] [11/12/13/14 Regression] [[____attr____]] causes internal compiler error: in decl_attributes, at attribs.cc:776
  2024-01-30 21:44 [Bug c++/113674] New: [[____attr____]] causes internal compiler error: in decl_attributes, at attribs.cc:776 mpolacek at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2024-01-31 16:38 ` jakub at gcc dot gnu.org
@ 2024-01-31 16:54 ` mpolacek at gcc dot gnu.org
  2024-01-31 18:40 ` jsm28 at gcc dot gnu.org
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2024-01-31 16:54 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113674

--- Comment #4 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
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.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug c++/113674] [11/12/13/14 Regression] [[____attr____]] causes internal compiler error: in decl_attributes, at attribs.cc:776
  2024-01-30 21:44 [Bug c++/113674] New: [[____attr____]] causes internal compiler error: in decl_attributes, at attribs.cc:776 mpolacek at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2024-01-31 16:54 ` mpolacek at gcc dot gnu.org
@ 2024-01-31 18:40 ` jsm28 at gcc dot gnu.org
  2024-02-12 12:23 ` jakub at gcc dot gnu.org
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: jsm28 at gcc dot gnu.org @ 2024-01-31 18:40 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113674

--- Comment #5 from Joseph S. Myers <jsm28 at gcc dot gnu.org> ---
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]].

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug c++/113674] [11/12/13/14 Regression] [[____attr____]] causes internal compiler error: in decl_attributes, at attribs.cc:776
  2024-01-30 21:44 [Bug c++/113674] New: [[____attr____]] causes internal compiler error: in decl_attributes, at attribs.cc:776 mpolacek at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2024-01-31 18:40 ` jsm28 at gcc dot gnu.org
@ 2024-02-12 12:23 ` jakub at gcc dot gnu.org
  2024-02-12 19:45 ` cvs-commit at gcc dot gnu.org
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: jakub at gcc dot gnu.org @ 2024-02-12 12:23 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113674

Jakub Jelinek <jakub at gcc dot gnu.org> 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 <jakub at gcc dot gnu.org> ---
Created attachment 57394
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=57394&action=edit
gcc14-pr113674.patch

Untested fix.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug c++/113674] [11/12/13/14 Regression] [[____attr____]] causes internal compiler error: in decl_attributes, at attribs.cc:776
  2024-01-30 21:44 [Bug c++/113674] New: [[____attr____]] causes internal compiler error: in decl_attributes, at attribs.cc:776 mpolacek at gcc dot gnu.org
                   ` (6 preceding siblings ...)
  2024-02-12 12:23 ` jakub at gcc dot gnu.org
@ 2024-02-12 19:45 ` cvs-commit at gcc dot gnu.org
  2024-02-12 19:48 ` [Bug c++/113674] [11/12/13 " jakub at gcc dot gnu.org
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-02-12 19:45 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113674

--- Comment #7 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jakub Jelinek <jakub@gcc.gnu.org>:

https://gcc.gnu.org/g:b42e978f29b33071addff6d7bb8bcdb11d176606

commit r14-8940-gb42e978f29b33071addff6d7bb8bcdb11d176606
Author: Jakub Jelinek <jakub@redhat.com>
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  <jakub@redhat.com>

            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.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug c++/113674] [11/12/13 Regression] [[____attr____]] causes internal compiler error: in decl_attributes, at attribs.cc:776
  2024-01-30 21:44 [Bug c++/113674] New: [[____attr____]] causes internal compiler error: in decl_attributes, at attribs.cc:776 mpolacek at gcc dot gnu.org
                   ` (7 preceding siblings ...)
  2024-02-12 19:45 ` cvs-commit at gcc dot gnu.org
@ 2024-02-12 19:48 ` jakub at gcc dot gnu.org
  2024-03-02  0:38 ` cvs-commit at gcc dot gnu.org
  2024-03-04 12:08 ` [Bug c++/113674] [11/12 " jakub at gcc dot gnu.org
  10 siblings, 0 replies; 12+ messages in thread
From: jakub at gcc dot gnu.org @ 2024-02-12 19:48 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113674

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[11/12/13/14 Regression]    |[11/12/13 Regression]
                   |[[____attr____]] causes     |[[____attr____]] causes
                   |internal compiler error: in |internal compiler error: in
                   |decl_attributes, at         |decl_attributes, at
                   |attribs.cc:776              |attribs.cc:776

--- Comment #8 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Fixed on the trunk so far.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug c++/113674] [11/12/13 Regression] [[____attr____]] causes internal compiler error: in decl_attributes, at attribs.cc:776
  2024-01-30 21:44 [Bug c++/113674] New: [[____attr____]] causes internal compiler error: in decl_attributes, at attribs.cc:776 mpolacek at gcc dot gnu.org
                   ` (8 preceding siblings ...)
  2024-02-12 19:48 ` [Bug c++/113674] [11/12/13 " jakub at gcc dot gnu.org
@ 2024-03-02  0:38 ` cvs-commit at gcc dot gnu.org
  2024-03-04 12:08 ` [Bug c++/113674] [11/12 " jakub at gcc dot gnu.org
  10 siblings, 0 replies; 12+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-03-02  0:38 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113674

--- Comment #9 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-13 branch has been updated by Jakub Jelinek
<jakub@gcc.gnu.org>:

https://gcc.gnu.org/g:9de6ff5ec9a46951d2c71b5b32574a516a72b907

commit r13-8390-g9de6ff5ec9a46951d2c71b5b32574a516a72b907
Author: Jakub Jelinek <jakub@redhat.com>
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  <jakub@redhat.com>

            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.

    (cherry picked from commit b42e978f29b33071addff6d7bb8bcdb11d176606)

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug c++/113674] [11/12 Regression] [[____attr____]] causes internal compiler error: in decl_attributes, at attribs.cc:776
  2024-01-30 21:44 [Bug c++/113674] New: [[____attr____]] causes internal compiler error: in decl_attributes, at attribs.cc:776 mpolacek at gcc dot gnu.org
                   ` (9 preceding siblings ...)
  2024-03-02  0:38 ` cvs-commit at gcc dot gnu.org
@ 2024-03-04 12:08 ` jakub at gcc dot gnu.org
  10 siblings, 0 replies; 12+ messages in thread
From: jakub at gcc dot gnu.org @ 2024-03-04 12:08 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113674

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[11/12/13 Regression]       |[11/12 Regression]
                   |[[____attr____]] causes     |[[____attr____]] causes
                   |internal compiler error: in |internal compiler error: in
                   |decl_attributes, at         |decl_attributes, at
                   |attribs.cc:776              |attribs.cc:776

--- Comment #10 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Should be now fixed for GCC 13.3+ too.

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2024-03-04 12:08 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-30 21:44 [Bug c++/113674] New: [[____attr____]] causes internal compiler error: in decl_attributes, at attribs.cc:776 mpolacek at gcc dot gnu.org
2024-01-30 21:46 ` [Bug c++/113674] [11/12/13/14 Regression] " mpolacek at gcc dot gnu.org
2024-01-31  8:21 ` rguenth at gcc dot gnu.org
2024-01-31 16:06 ` mpolacek at gcc dot gnu.org
2024-01-31 16:38 ` jakub at gcc dot gnu.org
2024-01-31 16:54 ` mpolacek at gcc dot gnu.org
2024-01-31 18:40 ` jsm28 at gcc dot gnu.org
2024-02-12 12:23 ` jakub at gcc dot gnu.org
2024-02-12 19:45 ` cvs-commit at gcc dot gnu.org
2024-02-12 19:48 ` [Bug c++/113674] [11/12/13 " jakub at gcc dot gnu.org
2024-03-02  0:38 ` cvs-commit at gcc dot gnu.org
2024-03-04 12:08 ` [Bug c++/113674] [11/12 " jakub at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).