public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/96364] New: ICE on valid code in cp_finish_decl, at cp/decl.c:7537
@ 2020-07-29  2:31 haoxintu at gmail dot com
  2020-08-03 19:58 ` [Bug c++/96364] " mpolacek at gcc dot gnu.org
  2023-01-30 23:03 ` [Bug c++/96364] ICE on valid code in cp_finish_decl with auto return type and double attributes pinskia at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: haoxintu at gmail dot com @ 2020-07-29  2:31 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 96364
           Summary: ICE on valid code in cp_finish_decl, at cp/decl.c:7537
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: haoxintu at gmail dot com
  Target Milestone: ---

Hi, all.

Weirdly, this simple valid code makes GCC ICE (clang,icc,or msvc accepts this
code).

Input:
//small.cc
auto a[[]] [[]]();

Command:
g++ small.cc

Output:
small.cc:1:17: internal compiler error: in cp_finish_decl, at cp/decl.c:7536
    1 | auto a[[]] [[]]();
      |                 ^
0x63f6dc cp_finish_decl(tree_node*, tree_node*, bool, tree_node*, int)
        ../../gcc/cp/decl.c:7536
0x9ed9b9 cp_parser_init_declarator
        ../../gcc/cp/parser.c:20990
0x9cdacc cp_parser_simple_declaration
        ../../gcc/cp/parser.c:13799
0x9f8d2e cp_parser_declaration
        ../../gcc/cp/parser.c:13498
0x9f941b cp_parser_translation_unit
        ../../gcc/cp/parser.c:4781
0x9f941b c_parse_file()
        ../../gcc/cp/parser.c:44069
0xb13e2d c_common_parse_file()
        ../../gcc/c-family/c-opts.c:1188
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

I have tested this in GCC-7.1 onwards versions, and they all behave the same.

Thanks,
Haoxin

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

* [Bug c++/96364] ICE on valid code in cp_finish_decl, at cp/decl.c:7537
  2020-07-29  2:31 [Bug c++/96364] New: ICE on valid code in cp_finish_decl, at cp/decl.c:7537 haoxintu at gmail dot com
@ 2020-08-03 19:58 ` mpolacek at gcc dot gnu.org
  2023-01-30 23:03 ` [Bug c++/96364] ICE on valid code in cp_finish_decl with auto return type and double attributes pinskia at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2020-08-03 19:58 UTC (permalink / raw)
  To: gcc-bugs

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

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2020-08-03
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1
                 CC|                            |mpolacek at gcc dot gnu.org

--- Comment #1 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
From-SVN: r240756

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

* [Bug c++/96364] ICE on valid code in cp_finish_decl with auto return type and double attributes
  2020-07-29  2:31 [Bug c++/96364] New: ICE on valid code in cp_finish_decl, at cp/decl.c:7537 haoxintu at gmail dot com
  2020-08-03 19:58 ` [Bug c++/96364] " mpolacek at gcc dot gnu.org
@ 2023-01-30 23:03 ` pinskia at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-01-30 23:03 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|ICE on valid code in        |ICE on valid code in
                   |cp_finish_decl, at          |cp_finish_decl with auto
                   |cp/decl.c:7537              |return type and double
                   |                            |attributes
           Keywords|                            |rejects-valid

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Full testcase:
```
auto a[[]] [[]]();

auto a() {}
void g()
{
    return a();
}
```

[[]][[]] is causing GCC to think a is a variable decl and not a function decl.
This was even true before Jason's r240756 .

It is even a rejects valid with:
```
void a[[]] [[]]();

void a() {}
void g()
{
    return a();
}
```
Which gives:
```
<source>:2:6: error: variable or field 'a' declared void
    2 | void a[[]] [[]]();
      |      ^
```
and that is not a regression as 4.8.1 even rejects it with that message.

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

end of thread, other threads:[~2023-01-30 23:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-29  2:31 [Bug c++/96364] New: ICE on valid code in cp_finish_decl, at cp/decl.c:7537 haoxintu at gmail dot com
2020-08-03 19:58 ` [Bug c++/96364] " mpolacek at gcc dot gnu.org
2023-01-30 23:03 ` [Bug c++/96364] ICE on valid code in cp_finish_decl with auto return type and double attributes pinskia 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).