public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/96637] New: ICE in tree check: expected tree_list, have error_mark in cp_check_const_attributes, at cp/decl2.c:1423
@ 2020-08-17  2:20 haoxintu at gmail dot com
  2020-08-18 13:44 ` [Bug c++/96637] " mpolacek at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: haoxintu at gmail dot com @ 2020-08-17  2:20 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 96637
           Summary: ICE in tree check: expected tree_list, have error_mark
                    in cp_check_const_attributes, at cp/decl2.c:1423
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Keywords: error-recovery, ice-on-invalid-code
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: haoxintu at gmail dot com
  Target Milestone: ---

Input:
//small.cc
void foo(int[] alignas[1] alignas(1)){}

Command:
g++ small.cc

Output:
small.cc:1:23: error: expected ‘(’ before ‘[’ token
    1 | void foo(int[] alignas[1] alignas(1)){}
      |                       ^
      |                       (
small.cc:1:36: internal compiler error: tree check: expected tree_list, have
error_mark in cp_check_const_attributes, at cp/decl2.c:1423
    1 | void foo(int[] alignas[1] alignas(1)){}
      |                                    ^
0x7e9339 tree_check_failed(tree_node const*, char const*, int, char const*,
...)
        ../../gcc/tree.c:9714
0x649182 tree_check(tree_node*, char const*, int, char const*, tree_code)
        ../../gcc/tree.h:3295
0x649182 cp_check_const_attributes(tree_node*)
        ../../gcc/cp/decl2.c:1423
0x955b72 cp_check_const_attributes(tree_node*)
        ../../gcc/cp/decl2.c:1416
0x955b72 cplus_decl_attributes(tree_node**, tree_node*, int)
        ../../gcc/cp/decl2.c:1584
0x9f27a4 cp_parser_parameter_declaration_list
        ../../gcc/cp/parser.c:22725
0x9f2b21 cp_parser_parameter_declaration_clause
        ../../gcc/cp/parser.c:22622
0x9df4f1 cp_parser_direct_declarator
        ../../gcc/cp/parser.c:21299
0x9df4f1 cp_parser_declarator
        ../../gcc/cp/parser.c:21163
0x9f4756 cp_parser_init_declarator
        ../../gcc/cp/parser.c:20663
0x9d4f7c cp_parser_simple_declaration
        ../../gcc/cp/parser.c:13811
0xa002fe cp_parser_declaration
        ../../gcc/cp/parser.c:13510
0xa009db cp_parser_translation_unit
        ../../gcc/cp/parser.c:4793
0xa009db c_parse_file()
        ../../gcc/cp/parser.c:44095
0xb1b9fd 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 tested this in trunk, and this also makes released GCC "confused by earlier
errors, bailing out".

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

* [Bug c++/96637] ICE in tree check: expected tree_list, have error_mark in cp_check_const_attributes, at cp/decl2.c:1423
  2020-08-17  2:20 [Bug c++/96637] New: ICE in tree check: expected tree_list, have error_mark in cp_check_const_attributes, at cp/decl2.c:1423 haoxintu at gmail dot com
@ 2020-08-18 13:44 ` mpolacek at gcc dot gnu.org
  2021-09-20 21:57 ` [Bug c++/96637] [9/10/11/12 Regression] " pinskia at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2020-08-18 13:44 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #1 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Confirmed.

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

* [Bug c++/96637] [9/10/11/12 Regression] ICE in tree check: expected tree_list, have error_mark in cp_check_const_attributes, at cp/decl2.c:1423
  2020-08-17  2:20 [Bug c++/96637] New: ICE in tree check: expected tree_list, have error_mark in cp_check_const_attributes, at cp/decl2.c:1423 haoxintu at gmail dot com
  2020-08-18 13:44 ` [Bug c++/96637] " mpolacek at gcc dot gnu.org
@ 2021-09-20 21:57 ` pinskia at gcc dot gnu.org
  2022-05-25 20:14 ` [Bug c++/96637] [9/10/11/12/13 " cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-09-20 21:57 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |9.5
            Summary|ICE in tree check: expected |[9/10/11/12 Regression] ICE
                   |tree_list, have error_mark  |in tree check: expected
                   |in                          |tree_list, have error_mark
                   |cp_check_const_attributes,  |in
                   |at cp/decl2.c:1423          |cp_check_const_attributes,
                   |                            |at cp/decl2.c:1423
      Known to work|                            |5.5.0
           Severity|normal                      |minor
      Known to fail|                            |6.1.0

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
In GCC 5.5.0 and before we only got the following error message and no confused
by earlier errors message:
<source>:1:16: error: expected ',' or '...' before 'alignas'
 void foo(int[] alignas[1] alignas(1)){}
                ^

GCC 6+ changed the error message to:
<source>:1:23: error: expected '(' before '[' token
 void foo(int[] alignas[1] alignas(1)){}
                       ^

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

* [Bug c++/96637] [9/10/11/12/13 Regression] ICE in tree check: expected tree_list, have error_mark in cp_check_const_attributes, at cp/decl2.c:1423
  2020-08-17  2:20 [Bug c++/96637] New: ICE in tree check: expected tree_list, have error_mark in cp_check_const_attributes, at cp/decl2.c:1423 haoxintu at gmail dot com
  2020-08-18 13:44 ` [Bug c++/96637] " mpolacek at gcc dot gnu.org
  2021-09-20 21:57 ` [Bug c++/96637] [9/10/11/12 Regression] " pinskia at gcc dot gnu.org
@ 2022-05-25 20:14 ` cvs-commit at gcc dot gnu.org
  2022-05-25 20:21 ` mpolacek at gcc dot gnu.org
  2023-07-07  6:07 ` pinskia at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-05-25 20:14 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The trunk branch has been updated by Marek Polacek <mpolacek@gcc.gnu.org>:

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

commit r13-770-gda2c56ee601ac696a76e469e33c88313428c5c5a
Author: Marek Polacek <polacek@redhat.com>
Date:   Thu Apr 28 13:21:41 2022 -0400

    c++: fix ICE on invalid attributes [PR96637]

    When chaining attributes, attr_chainon should be used rather than plain
    chainon, so that we don't end up with a TREE_LIST where one of the elements
    is error_mark_node, which causes problems.  parser.cc has already been
    fixed to use attr_chainon, but decl.cc has not.  Until now.

            PR c++/96637

    gcc/cp/ChangeLog:

            * cp-tree.h (attr_chainon): Declare.
            * decl.cc (start_decl): Use attr_chainon.
            (grokdeclarator): Likewise.
            * parser.cc (cp_parser_statement): No longer static.

    gcc/testsuite/ChangeLog:

            * g++.dg/parse/error64.C: New test.

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

* [Bug c++/96637] [9/10/11/12/13 Regression] ICE in tree check: expected tree_list, have error_mark in cp_check_const_attributes, at cp/decl2.c:1423
  2020-08-17  2:20 [Bug c++/96637] New: ICE in tree check: expected tree_list, have error_mark in cp_check_const_attributes, at cp/decl2.c:1423 haoxintu at gmail dot com
                   ` (2 preceding siblings ...)
  2022-05-25 20:14 ` [Bug c++/96637] [9/10/11/12/13 " cvs-commit at gcc dot gnu.org
@ 2022-05-25 20:21 ` mpolacek at gcc dot gnu.org
  2023-07-07  6:07 ` pinskia at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2022-05-25 20:21 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #4 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Fixed for GCC 13.

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

* [Bug c++/96637] [9/10/11/12/13 Regression] ICE in tree check: expected tree_list, have error_mark in cp_check_const_attributes, at cp/decl2.c:1423
  2020-08-17  2:20 [Bug c++/96637] New: ICE in tree check: expected tree_list, have error_mark in cp_check_const_attributes, at cp/decl2.c:1423 haoxintu at gmail dot com
                   ` (3 preceding siblings ...)
  2022-05-25 20:21 ` mpolacek at gcc dot gnu.org
@ 2023-07-07  6:07 ` pinskia at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-07-07  6:07 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
*** Bug 96638 has been marked as a duplicate of this bug. ***

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

end of thread, other threads:[~2023-07-07  6:07 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-17  2:20 [Bug c++/96637] New: ICE in tree check: expected tree_list, have error_mark in cp_check_const_attributes, at cp/decl2.c:1423 haoxintu at gmail dot com
2020-08-18 13:44 ` [Bug c++/96637] " mpolacek at gcc dot gnu.org
2021-09-20 21:57 ` [Bug c++/96637] [9/10/11/12 Regression] " pinskia at gcc dot gnu.org
2022-05-25 20:14 ` [Bug c++/96637] [9/10/11/12/13 " cvs-commit at gcc dot gnu.org
2022-05-25 20:21 ` mpolacek at gcc dot gnu.org
2023-07-07  6:07 ` 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).