Bug 117753 - [12/13/14/15 Regression] ICE: tree check: expected class ‘type’, have ‘exceptional’ (error_mark) in build_int_cst, at tree.cc:1533
Summary: [12/13/14/15 Regression] ICE: tree check: expected class ‘type’, have ‘except...
Status: NEW
Alias: None
Product: gcc
Classification: Unclassified
Component: c (show other bugs)
Version: 15.0
: P4 normal
Target Milestone: 12.5
Assignee: Not yet assigned to anyone
URL:
Keywords: error-recovery, ice-on-invalid-code
Depends on:
Blocks:
 
Reported: 2024-11-23 09:46 UTC by Xieym
Modified: 2024-11-25 07:28 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2024-11-24 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Xieym 2024-11-23 09:46:16 UTC
$ cat 20241123025220_16.c
extern int n;

void f1(int[n]);

void n(int[n], int[n], int[n], int[n], int[n], int[n], int[n], int[n]);

void f1(int[n]);
$ gcc-trunk -v
Using built-in specs.
COLLECT_GCC=/data/xieym/exp/gcc/test_data/gcc-latest-install/bin/gcc
COLLECT_LTO_WRAPPER=/data/xieym/exp/gcc/test_data/gcc-latest-install/libexec/gcc/x86_64-pc-linux-gnu/15.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /data/xieym/exp/gcc/test_data/gcc-latest-src/configure --enable-coverage --enable-checking --disable-multilib --disable-shared --disable-bootstrap --enable-languages=c,c++ --prefix=/data/xieym/exp/gcc/test_data/gcc-latest-install
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 15.0.0 20241123 (experimental) (GCC)
$ gcc-trunk -x c -std=c2x -c 20241123025220_16.c -o /dev/null
20241123025220_16.c:5:6: error: ‘n’ redeclared as different kind of symbol
    5 | void n(int[n], int[n], int[n], int[n], int[n], int[n], int[n], int[n]);
      |      ^
20241123025220_16.c:1:12: note: previous declaration of ‘n’ with type ‘int’
    1 | extern int n;
      |            ^
20241123025220_16.c:7:12: error: size of unnamed array has non-integer type
    7 | void f1(int[n]);
      |            ^
20241123025220_16.c:7:1: internal compiler error: tree check: expected class ‘type’, have ‘exceptional’ (error_mark) in build_int_cst, at tree.cc:1533
    7 | void f1(int[n]);
      | ^~~~
0x567214e internal_error(char const*, ...)
        /data/xieym/exp/gcc/test_data/gcc-latest-src/gcc/diagnostic-global-context.cc:517
0x27bd5cd tree_class_check_failed(tree_node const*, tree_code_class, char const*, int, char const*)
        /data/xieym/exp/gcc/test_data/gcc-latest-src/gcc/tree.cc:9081
0xe09b06 tree_class_check(tree_node*, tree_code_class, char const*, int, char const*)
        /data/xieym/exp/gcc/test_data/gcc-latest-src/gcc/tree.h:3817
0x2788b1d build_int_cst(tree_node*, poly_int<1u, long>)
        /data/xieym/exp/gcc/test_data/gcc-latest-src/gcc/tree.cc:1533
0x165db48 round_up_loc(unsigned int, tree_node*, unsigned int)
        /data/xieym/exp/gcc/test_data/gcc-latest-src/gcc/fold-const.cc:16793
0x1fcc548 finalize_type_size
        /data/xieym/exp/gcc/test_data/gcc-latest-src/gcc/stor-layout.cc:2005
0x1fd4c4b layout_type(tree_node*)
        /data/xieym/exp/gcc/test_data/gcc-latest-src/gcc/stor-layout.cc:2801
0x27b1c9d build_array_type_1(tree_node*, tree_node*, bool, bool, bool)
        /data/xieym/exp/gcc/test_data/gcc-latest-src/gcc/tree.cc:7398
0x27b210e build_array_type(tree_node*, tree_node*, bool)
        /data/xieym/exp/gcc/test_data/gcc-latest-src/gcc/tree.cc:7433
0xe084cf attr_access::array_as_string[abi:cxx11](tree_node*) const
        /data/xieym/exp/gcc/test_data/gcc-latest-src/gcc/attribs.cc:2673
0x1182b02 warn_parm_array_mismatch(unsigned int, tree_node*, tree_node*)
        /data/xieym/exp/gcc/test_data/gcc-latest-src/gcc/c-family/c-warn.cc:3539
0xf32702 c_parser_declaration_or_fndef
        /data/xieym/exp/gcc/test_data/gcc-latest-src/gcc/c/c-parser.cc:2847
0xf2e9a8 c_parser_external_declaration
        /data/xieym/exp/gcc/test_data/gcc-latest-src/gcc/c/c-parser.cc:2067
0xf2de4f c_parser_translation_unit
        /data/xieym/exp/gcc/test_data/gcc-latest-src/gcc/c/c-parser.cc:1921
0xfd0439 c_parse_file()
        /data/xieym/exp/gcc/test_data/gcc-latest-src/gcc/c/c-parser.cc:28878
0x10fb285 c_common_parse_file()
        /data/xieym/exp/gcc/test_data/gcc-latest-src/gcc/c-family/c-opts.cc:1374
Please submit a full bug report, with preprocessed source (by using -freport-bug).
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.
Comment 1 Andrew Pinski 2024-11-24 20:42:35 UTC
Confirmed.

Reduced testcase:
```
int n;
void f1(int[n]);
float n();
void f1(int[n]);
```