public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/115469] New: ICE :tree check expected class 'type', have 'exceptional' (error_mark) in poplevel_named_label_1, at cpdecl.cc579
@ 2024-06-13  4:29 iamanonymous.cs at gmail dot com
  2024-06-13  4:41 ` [Bug c++/115469] [14/15 Regression] " pinskia at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: iamanonymous.cs at gmail dot com @ 2024-06-13  4:29 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 115469
           Summary: ICE :tree check expected class 'type', have
                    'exceptional' (error_mark) in poplevel_named_label_1,
                    at cpdecl.cc579
           Product: gcc
           Version: 15.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: iamanonymous.cs at gmail dot com
  Target Milestone: ---
            Target: x86_64

*******************************************************************************
I encountered an internal compiler error (ICE) while compiling the following
code snippet using GCC trunk with the provided compilation options.
The ICE occurred in poplevel_named_label_1 at cp/decl.cc:579. 
The issue can also be reproduced on Compiler Explorer.
Please let me know if you need any further information to resolve this issue.

*******************************************************************************
OS and Platform:
# uname -a
Linux ubuntu 4.15.0-213-generic #224-Ubuntu SMP Mon Jun 19 13:30:12 UTC 2023
x86_64 x86_64 x86_64 GNU/Linux
*******************************************************************************
# g++ -v
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/root/gdbtest/gcc/gcc-15/libexec/gcc/x86_64-pc-linux-gnu/15.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /root/gdbtest/gcc/obj/../gcc/configure
--prefix=/root/gdbtest/gcc/gcc-15 --enable-languages=c,c++,fortran,go
--disable-multilib
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 15.0.0 20240509 (experimental) (GCC) 
*******************************************************************************
Program:
# cat 1.ii

int fn1() { int **c; b = &&c;   goto * 0}

*******************************************************************************
Command Lines:
# g++ 1.ii -O3 -Wall -Wextra -std=c11 -pedantic -fsanitize=undefined
-fstack-protector-all -D_FORTIFY_SOURCE=2 -freport-bug -o -c 1.o
cc1plus: warning: command-line option ‘-std=c11’ is valid for C/ObjC but not
for C++
1.ii: In function ‘int fn1()’:
1.ii:1:22: error: ‘b’ was not declared in this scope
    1 | int fn1() { int **c; b = &&c;   goto * 0}
      |                      ^
1.ii:1:28: warning: taking the address of a label is non-standard [-Wpedantic]
    1 | int fn1() { int **c; b = &&c;   goto * 0}
      |                            ^
1.ii:1:33: warning: ISO C++ forbids computed gotos [-Wpedantic]
    1 | int fn1() { int **c; b = &&c;   goto * 0}
      |                                 ^~~~
1.ii:1:41: error: expected ‘;’ before ‘}’ token
    1 | int fn1() { int **c; b = &&c;   goto * 0}
      |                                         ^
      |                                         ;
1.ii:1:41: internal compiler error: tree check: expected class ‘type’, have
‘exceptional’ (error_mark) in poplevel_named_label_1, at cp/decl.cc:579
0x99e778 tree_class_check_failed(tree_node const*, tree_code_class, char
const*, int, char const*)
        /root/gdbtest/gcc/obj/../gcc/gcc/tree.cc:9045
0x7d7cca tree_class_check(tree_node*, tree_code_class, char const*, int, char
const*)
        /root/gdbtest/gcc/obj/../gcc/gcc/tree.h:3779
0x7d7cca poplevel_named_label_1(named_label_entry**, cp_binding_level*)
        /root/gdbtest/gcc/obj/../gcc/gcc/cp/decl.cc:579
0xb735f8 void hash_table<named_label_hash, false,
xcallocator>::traverse_noresize<cp_binding_level*,
&(poplevel_named_label_1(named_label_entry**,
cp_binding_level*))>(cp_binding_level*)
        /root/gdbtest/gcc/obj/../gcc/gcc/cp/decl.cc:650
0xb735f8 void hash_table<named_label_hash, false,
xcallocator>::traverse<cp_binding_level*,
&(poplevel_named_label_1(named_label_entry**,
cp_binding_level*))>(cp_binding_level*)
        /root/gdbtest/gcc/obj/../gcc/gcc/hash-table.h:1194
0xb735f8 poplevel(int, int, int)
        /root/gdbtest/gcc/obj/../gcc/gcc/cp/decl.cc:650
0xd04842 do_poplevel(tree_node*)
        /root/gdbtest/gcc/obj/../gcc/gcc/cp/semantics.cc:651
0xd07599 finish_compound_stmt(tree_node*)
        /root/gdbtest/gcc/obj/../gcc/gcc/cp/semantics.cc:1996
0xc59a4c cp_parser_compound_statement
        /root/gdbtest/gcc/obj/../gcc/gcc/cp/parser.cc:13287
0xc7ccd5 cp_parser_function_body
        /root/gdbtest/gcc/obj/../gcc/gcc/cp/parser.cc:26072
0xc7ccd5 cp_parser_ctor_initializer_opt_and_function_body
        /root/gdbtest/gcc/obj/../gcc/gcc/cp/parser.cc:26123
0xc8241e cp_parser_function_definition_after_declarator
        /root/gdbtest/gcc/obj/../gcc/gcc/cp/parser.cc:32903
0xc835be cp_parser_function_definition_from_specifiers_and_declarator
        /root/gdbtest/gcc/obj/../gcc/gcc/cp/parser.cc:32820
0xc835be cp_parser_init_declarator
        /root/gdbtest/gcc/obj/../gcc/gcc/cp/parser.cc:23451
0xc5668f cp_parser_simple_declaration
        /root/gdbtest/gcc/obj/../gcc/gcc/cp/parser.cc:15958
0xc8ffea cp_parser_declaration
        /root/gdbtest/gcc/obj/../gcc/gcc/cp/parser.cc:15631
0xc90fea cp_parser_toplevel_declaration
        /root/gdbtest/gcc/obj/../gcc/gcc/cp/parser.cc:15652
0xc90fea cp_parser_translation_unit
        /root/gdbtest/gcc/obj/../gcc/gcc/cp/parser.cc:5284
0xc90fea c_parse_file()
        /root/gdbtest/gcc/obj/../gcc/gcc/cp/parser.cc:51440
0xddf371 c_common_parse_file()
        /root/gdbtest/gcc/obj/../gcc/gcc/c-family/c-opts.cc:1311
Please submit a full bug report, with preprocessed source.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.
Preprocessed source stored into /tmp/cc5sFDUL.out file, please attach this to
your bugreport.

*******************************************************************************

#cat /tmp/cc5sFDUL.out
// Target: x86_64-pc-linux-gnu
// Configured with: /root/gdbtest/gcc/obj/../gcc/configure
--prefix=/root/gdbtest/gcc/gcc-15 --enable-languages=c,c++,fortran,go
--disable-multilib
// Thread model: posix
// Supported LTO compression algorithms: zlib
// gcc version 15.0.0 20240509 (experimental) (GCC) 
// 
// -fpreprocessed: warning: command-line option ‘-std=c11’ is valid for C/ObjC
but not for C++
// 1.ii: In function ‘int fn1()’:
// 1.ii:1:22: error: ‘b’ was not declared in this scope
//     1 | int fn1() { int **c; b = &&c;   goto * 0}
//       |                      ^
// 1.ii:1:28: warning: taking the address of a label is non-standard
[-Wpedantic]
//     1 | int fn1() { int **c; b = &&c;   goto * 0}
//       |                            ^
// 1.ii:1:33: warning: ISO C++ forbids computed gotos [-Wpedantic]
//     1 | int fn1() { int **c; b = &&c;   goto * 0}
//       |                                 ^~~~
// 1.ii:1:41: error: expected ‘;’ before ‘}’ token
//     1 | int fn1() { int **c; b = &&c;   goto * 0}
//       |                                         ^
//       |                                         ;
// 1.ii:1:41: internal compiler error: tree check: expected class ‘type’, have
‘exceptional’ (error_mark) in poplevel_named_label_1, at cp/decl.cc:579
// 0x99e778 tree_class_check_failed(tree_node const*, tree_code_class, char
const*, int, char const*)
//      /root/gdbtest/gcc/obj/../gcc/gcc/tree.cc:9045
// 0x7d7cca tree_class_check(tree_node*, tree_code_class, char const*, int,
char const*)
//      /root/gdbtest/gcc/obj/../gcc/gcc/tree.h:3779
// 0x7d7cca poplevel_named_label_1(named_label_entry**, cp_binding_level*)
//      /root/gdbtest/gcc/obj/../gcc/gcc/cp/decl.cc:579
// 0xb735f8 void hash_table<named_label_hash, false,
xcallocator>::traverse_noresize<cp_binding_level*,
&(poplevel_named_label_1(named_label_entry**,
cp_binding_level*))>(cp_binding_level*)
//      /root/gdbtest/gcc/obj/../gcc/gcc/cp/decl.cc:650
// 0xb735f8 void hash_table<named_label_hash, false,
xcallocator>::traverse<cp_binding_level*,
&(poplevel_named_label_1(named_label_entry**,
cp_binding_level*))>(cp_binding_level*)
//      /root/gdbtest/gcc/obj/../gcc/gcc/hash-table.h:1194
// 0xb735f8 poplevel(int, int, int)
//      /root/gdbtest/gcc/obj/../gcc/gcc/cp/decl.cc:650
// 0xd04842 do_poplevel(tree_node*)
//      /root/gdbtest/gcc/obj/../gcc/gcc/cp/semantics.cc:651
// 0xd07599 finish_compound_stmt(tree_node*)
//      /root/gdbtest/gcc/obj/../gcc/gcc/cp/semantics.cc:1996
// 0xc59a4c cp_parser_compound_statement
//      /root/gdbtest/gcc/obj/../gcc/gcc/cp/parser.cc:13287
// 0xc7ccd5 cp_parser_function_body
//      /root/gdbtest/gcc/obj/../gcc/gcc/cp/parser.cc:26072
// 0xc7ccd5 cp_parser_ctor_initializer_opt_and_function_body
//      /root/gdbtest/gcc/obj/../gcc/gcc/cp/parser.cc:26123
// 0xc8241e cp_parser_function_definition_after_declarator
//      /root/gdbtest/gcc/obj/../gcc/gcc/cp/parser.cc:32903
// 0xc835be cp_parser_function_definition_from_specifiers_and_declarator
//      /root/gdbtest/gcc/obj/../gcc/gcc/cp/parser.cc:32820
// 0xc835be cp_parser_init_declarator
//      /root/gdbtest/gcc/obj/../gcc/gcc/cp/parser.cc:23451
// 0xc5668f cp_parser_simple_declaration
//      /root/gdbtest/gcc/obj/../gcc/gcc/cp/parser.cc:15958
// 0xc8ffea cp_parser_declaration
//      /root/gdbtest/gcc/obj/../gcc/gcc/cp/parser.cc:15631
// 0xc90fea cp_parser_toplevel_declaration
//      /root/gdbtest/gcc/obj/../gcc/gcc/cp/parser.cc:15652
// 0xc90fea cp_parser_translation_unit
//      /root/gdbtest/gcc/obj/../gcc/gcc/cp/parser.cc:5284
// 0xc90fea c_parse_file()
//      /root/gdbtest/gcc/obj/../gcc/gcc/cp/parser.cc:51440
// 0xddf371 c_common_parse_file()
//      /root/gdbtest/gcc/obj/../gcc/gcc/c-family/c-opts.cc:1311
// Please submit a full bug report, with preprocessed source.
// Please include the complete backtrace with any bug report.
// See <https://gcc.gnu.org/bugs/> for instructions.

// /root/gdbtest/gcc/gcc-15/libexec/gcc/x86_64-pc-linux-gnu/15.0.0/cc1plus
-fpreprocessed 1.ii -quiet -dumpdir -c- -dumpbase 1.ii -dumpbase-ext .ii
-mtune=generic -march=x86-64 -O3 -Wall -Wextra -Wpedantic -std=c11
-fsanitize=undefined -fstack-protector-all -freport-bug -o - -frandom-seed=0
-fdump-noaddr

# 0 "1.ii"
# 0 "<built-in>"
# 0 "<command-line>"
# 1 "/usr/include/stdc-predef.h" 1 3 4
# 0 "<command-line>" 2
# 1 "1.ii"
int fn1() { int **c; b = &&c; goto * 0}

*******************************************************************************

Also ICE on trunk, compiler explorer:https://godbolt.org/z/jWYrKcqo6

*******************************************************************************

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

* [Bug c++/115469] [14/15 Regression] ICE :tree check expected class 'type', have 'exceptional' (error_mark) in poplevel_named_label_1, at cpdecl.cc579
  2024-06-13  4:29 [Bug c++/115469] New: ICE :tree check expected class 'type', have 'exceptional' (error_mark) in poplevel_named_label_1, at cpdecl.cc579 iamanonymous.cs at gmail dot com
@ 2024-06-13  4:41 ` pinskia at gcc dot gnu.org
  2024-06-13  7:27 ` rguenth at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-06-13  4:41 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
            Summary|ICE :tree check expected    |[14/15 Regression] ICE
                   |class 'type', have          |:tree check expected class
                   |'exceptional' (error_mark)  |'type', have 'exceptional'
                   |in poplevel_named_label_1,  |(error_mark) in
                   |at cpdecl.cc579             |poplevel_named_label_1, at
                   |                            |cpdecl.cc579
   Last reconfirmed|                            |2024-06-13
   Target Milestone|---                         |15.0
           See Also|                            |https://gcc.gnu.org/bugzill
                   |                            |a/show_bug.cgi?id=37722
     Ever confirmed|0                           |1
      Known to fail|                            |15.0

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed. Looks to be new in GCC 14; looking like r14-6765-g4d9e0f3f211c8c (PR
37722) caused it.
Reduced testcase:
```
void fn1() { b = &&c;  goto *0;}
```

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

* [Bug c++/115469] [14/15 Regression] ICE :tree check expected class 'type', have 'exceptional' (error_mark) in poplevel_named_label_1, at cpdecl.cc579
  2024-06-13  4:29 [Bug c++/115469] New: ICE :tree check expected class 'type', have 'exceptional' (error_mark) in poplevel_named_label_1, at cpdecl.cc579 iamanonymous.cs at gmail dot com
  2024-06-13  4:41 ` [Bug c++/115469] [14/15 Regression] " pinskia at gcc dot gnu.org
@ 2024-06-13  7:27 ` rguenth at gcc dot gnu.org
  2024-06-14  0:03 ` mpolacek at gcc dot gnu.org
  2024-06-14  0:14 ` mpolacek at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: rguenth at gcc dot gnu.org @ 2024-06-13  7:27 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P4
   Target Milestone|15.0                        |14.2

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

* [Bug c++/115469] [14/15 Regression] ICE :tree check expected class 'type', have 'exceptional' (error_mark) in poplevel_named_label_1, at cpdecl.cc579
  2024-06-13  4:29 [Bug c++/115469] New: ICE :tree check expected class 'type', have 'exceptional' (error_mark) in poplevel_named_label_1, at cpdecl.cc579 iamanonymous.cs at gmail dot com
  2024-06-13  4:41 ` [Bug c++/115469] [14/15 Regression] " pinskia at gcc dot gnu.org
  2024-06-13  7:27 ` rguenth at gcc dot gnu.org
@ 2024-06-14  0:03 ` mpolacek at gcc dot gnu.org
  2024-06-14  0:14 ` mpolacek at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2024-06-14  0:03 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #2 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
(In reply to Andrew Pinski from comment #1)
> Confirmed. Looks to be new in GCC 14; looking like r14-6765-g4d9e0f3f211c8c
> (PR 37722) caused it.

Correct.

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

* [Bug c++/115469] [14/15 Regression] ICE :tree check expected class 'type', have 'exceptional' (error_mark) in poplevel_named_label_1, at cpdecl.cc579
  2024-06-13  4:29 [Bug c++/115469] New: ICE :tree check expected class 'type', have 'exceptional' (error_mark) in poplevel_named_label_1, at cpdecl.cc579 iamanonymous.cs at gmail dot com
                   ` (2 preceding siblings ...)
  2024-06-14  0:03 ` mpolacek at gcc dot gnu.org
@ 2024-06-14  0:14 ` mpolacek at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2024-06-14  0:14 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
*** Bug 115472 has been marked as a duplicate of this bug. ***

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

end of thread, other threads:[~2024-06-14  0:14 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-06-13  4:29 [Bug c++/115469] New: ICE :tree check expected class 'type', have 'exceptional' (error_mark) in poplevel_named_label_1, at cpdecl.cc579 iamanonymous.cs at gmail dot com
2024-06-13  4:41 ` [Bug c++/115469] [14/15 Regression] " pinskia at gcc dot gnu.org
2024-06-13  7:27 ` rguenth at gcc dot gnu.org
2024-06-14  0:03 ` mpolacek at gcc dot gnu.org
2024-06-14  0:14 ` mpolacek 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).