public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* [attribs.cc] ICE with 4x underscores
@ 2024-01-30 10:34 Amol Surati
  2024-01-30 12:25 ` Jonathan Wakely
  0 siblings, 1 reply; 3+ messages in thread
From: Amol Surati @ 2024-01-30 10:34 UTC (permalink / raw)
  To: gcc

Hello,

If a std attribute name is squeezed between 4x underscores,
the compiler (both 13.2 [1] and trunk [2]) experiences an ICE.
for e.g. when using [[____deprecated____]] int a;

But, [[____depreated____]] int a; (i.e. the char 'c' removed from the
spelling) does not cause ICE.

Clang does not crash.

Stack trace with ICE:

    <source>:1:1: internal compiler error: in decl_attributes, at attribs.cc:751
        1 | [[____deprecated____]] int a;
          | ^
    0x1b49b1e internal_error(char const*, ...)
    ???:0
    0x6f805c fancy_abort(char const*, int, char const*)
    ???:0
    0x70f62d decl_attributes(tree_node**, tree_node*, int, tree_node*)
    ???:0
    0x728c0e start_decl(c_declarator*, c_declspecs*, bool, tree_node*,
bool, unsigned int*)
    ???:0
    0x7865dd c_parse_file()
    ???:0
    0x7e60b9 c_common_parse_file()
    ???:0

Thank you,
Amol

[1] https://godbolt.org/z/6PaMd9n6x
[2] https://godbolt.org/z/fc48q5PTW

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

* Re: [attribs.cc] ICE with 4x underscores
  2024-01-30 10:34 [attribs.cc] ICE with 4x underscores Amol Surati
@ 2024-01-30 12:25 ` Jonathan Wakely
  2024-01-30 21:49   ` Marek Polacek
  0 siblings, 1 reply; 3+ messages in thread
From: Jonathan Wakely @ 2024-01-30 12:25 UTC (permalink / raw)
  To: Amol Surati; +Cc: gcc

[-- Attachment #1: Type: text/plain, Size: 1232 bytes --]

On Tue, 30 Jan 2024, 10:35 Amol Surati via Gcc, <gcc@gcc.gnu.org> wrote:

> Hello,
>
> If a std attribute name is squeezed between 4x underscores,
>

Which is undefined behaviour, but shouldn't crash.

the compiler (both 13.2 [1] and trunk [2]) experiences an ICE.
>

Bug reports belong in bugzilla, not on the mailing list please.

https://gcc.gnu.org/bugs/

for e.g. when using [[____deprecated____]] int a;
>
> But, [[____depreated____]] int a; (i.e. the char 'c' removed from the
> spelling) does not cause ICE.
>
> Clang does not crash.
>
> Stack trace with ICE:
>
>     <source>:1:1: internal compiler error: in decl_attributes, at
> attribs.cc:751
>         1 | [[____deprecated____]] int a;
>           | ^
>     0x1b49b1e internal_error(char const*, ...)
>     ???:0
>     0x6f805c fancy_abort(char const*, int, char const*)
>     ???:0
>     0x70f62d decl_attributes(tree_node**, tree_node*, int, tree_node*)
>     ???:0
>     0x728c0e start_decl(c_declarator*, c_declspecs*, bool, tree_node*,
> bool, unsigned int*)
>     ???:0
>     0x7865dd c_parse_file()
>     ???:0
>     0x7e60b9 c_common_parse_file()
>     ???:0
>
> Thank you,
> Amol
>
> [1] https://godbolt.org/z/6PaMd9n6x
> [2] https://godbolt.org/z/fc48q5PTW
>

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

* Re: [attribs.cc] ICE with 4x underscores
  2024-01-30 12:25 ` Jonathan Wakely
@ 2024-01-30 21:49   ` Marek Polacek
  0 siblings, 0 replies; 3+ messages in thread
From: Marek Polacek @ 2024-01-30 21:49 UTC (permalink / raw)
  To: Jonathan Wakely; +Cc: Amol Surati, gcc

On Tue, Jan 30, 2024 at 12:25:24PM +0000, Jonathan Wakely via Gcc wrote:
> On Tue, 30 Jan 2024, 10:35 Amol Surati via Gcc, <gcc@gcc.gnu.org> wrote:
> 
> > Hello,
> >
> > If a std attribute name is squeezed between 4x underscores,
> >
> 
> Which is undefined behaviour, but shouldn't crash.
> 
> the compiler (both 13.2 [1] and trunk [2]) experiences an ICE.
> >
> 
> Bug reports belong in bugzilla, not on the mailing list please.
> 
> https://gcc.gnu.org/bugs/

I've created <https://gcc.gnu.org/PR113674>:
[[____attr____]] causes internal compiler error: in decl_attributes, at attribs.cc:776

which crashes with both cc1{,plus}.  The problem happens when the attribute
is both in std_attributes and c_common_gnu_attributes, it seems.

Marek


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

end of thread, other threads:[~2024-01-30 21:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-30 10:34 [attribs.cc] ICE with 4x underscores Amol Surati
2024-01-30 12:25 ` Jonathan Wakely
2024-01-30 21:49   ` Marek Polacek

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).