https://gcc.gnu.org/bugzilla/show_bug.cgi?id=128336
Bug ID: 128336
Summary: [17 Regression] internal compiler error: tree check:
expected class 'type', have 'exceptional' (error_mark)
in create_tmp_from_val, at gimplify.cc:632
Product: gcc
Version: 17.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: ---
Hi,
$cat small.c
union u {double d;long long ll;};
int f(double x, int n){union u v;v.d=0.0; v.ll=0; int r = 0; #define STR(x) #x
#define PASTE(a,b) a##b #define EMPTY #define EMPTY_STR(x) #x #define
PASTE_EMPTY(a) a## int r = PASTE(1,2); r += PASTE_EMPTY(x); int x = 5; r += x;
r += PASTE(1,2) + PASTE(3,4); r += PASTE_EMPTY(y); int y = 10; r += y; return
r;}
$gcc-trunk -c small.c
..///
small.c:3:194: internal compiler error: tree check: expected class 'type', have
'exceptional' (error_mark) in create_tmp_from_val, at gimplify.cc:632
3 | int f(double x, int n){union u v;v.d=0.0; v.ll=0; int r = 0; #define
STR(x) #x #define PASTE(a,b) a##b #define EMPTY #define EMPTY_STR(x) #x #define
PASTE_EMPTY(a) a## int r = PASTE(1,2); r += PASTE_EMPTY(x); int x = 5; r += x;
r += PASTE(1,2) + PASTE(3,4); r += PASTE_EMPTY(y); int y = 10; r += y; return
r;}
|
^~~~~~~~~~~~~~
0x5f0189d internal_error(char const*, ...)
/home/haoxin/research/cottontail/gcc/gcc/diagnostic-global-context.cc:787
0x2bb03e5 tree_class_check_failed(tree_node const*, tree_code_class, char
const*, int, char const*)
/home/haoxin/research/cottontail/gcc/gcc/tree.cc:9296
0x1007d57 tree_class_check(tree_node*, tree_code_class, char const*, int, char
const*)
/home/haoxin/research/cottontail/gcc/gcc/tree.h:3992
0x1a909a4 create_tmp_from_val
/home/haoxin/research/cottontail/gcc/gcc/gimplify.cc:632
0x1a90b3d lookup_tmp_var
/home/haoxin/research/cottontail/gcc/gcc/gimplify.cc:655
0x1a910c1 internal_get_tmp_var
/home/haoxin/research/cottontail/gcc/gcc/gimplify.cc:710
0x1a91542 get_initialized_tmp_var(tree_node*, gimple**, gimple**, bool)
/home/haoxin/research/cottontail/gcc/gcc/gimplify.cc:754
0x1abf02a gimplify_save_expr
/home/haoxin/research/cottontail/gcc/gcc/gimplify.cc:7683
0x1b2624d gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
/home/haoxin/research/cottontail/gcc/gcc/gimplify.cc:20827
0x1ac4d5f gimplify_stmt(tree_node**, gimple**)
/home/haoxin/research/cottontail/gcc/gcc/gimplify.cc:8577
0x1abecc1 gimplify_compound_expr
/home/haoxin/research/cottontail/gcc/gcc/gimplify.cc:7632
0x1b24194 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
/home/haoxin/research/cottontail/gcc/gcc/gimplify.cc:20516
0x1ac4d5f gimplify_stmt(tree_node**, gimple**)
/home/haoxin/research/cottontail/gcc/gcc/gimplify.cc:8577
0x1a9b71e gimplify_statement_list
/home/haoxin/research/cottontail/gcc/gcc/gimplify.cc:2166
0x1b276d8 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
/home/haoxin/research/cottontail/gcc/gcc/gimplify.cc:20977
0x1ac4d5f gimplify_stmt(tree_node**, gimple**)
/home/haoxin/research/cottontail/gcc/gcc/gimplify.cc:8577
0x1a977c6 gimplify_bind_expr
/home/haoxin/research/cottontail/gcc/gcc/gimplify.cc:1561
0x1b2586f gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
/home/haoxin/research/cottontail/gcc/gcc/gimplify.cc:20727
0x1ac4d5f gimplify_stmt(tree_node**, gimple**)
/home/haoxin/research/cottontail/gcc/gcc/gimplify.cc:8577
0x1b2c8b8 gimplify_body(tree_node*, bool)
/home/haoxin/research/cottontail/gcc/gcc/gimplify.cc:21833
/home/haoxin/research/cottontail/gcc/build-gcov/install/libexec/gcc/x86_64-pc-linux-gnu/17.0.0/cc1
-quiet -imultiarch x86_64-linux-gnu case.c -quiet -dumpbase case.c
-dumpbase-ext .c -mtune=generic -march=x86-64 -o /tmp/ccICuzBw.s
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.
$gcc-trunk -v
Using built-in specs.
COLLECT_GCC=../../../../../../gcc/build-gcov/install/bin/gcc
COLLECT_LTO_WRAPPER=xxx/gcc/build-gcov/install/libexec/gcc/x86_64-pc-linux-gnu/17.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: xxx/gcc/configure --prefix=xxx/gcc/build-gcov/install
--disable-multilib --disable-bootstrap --disable-werror --disable-libsanitizer
--disable-nls --enable-languages=c,lto CC=gcc CXX=g++ CFLAGS='--coverage
-fprofile-arcs -ftest-coverage -g -O0' CXXFLAGS='--coverage -fprofile-arcs
-ftest-coverage -g -O0' LDFLAGS=--coverage
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 17.0.0 20261017 (experimental) (GCC)
Reproduced in godblot: https://godbolt.org/z/WxE44h98P
This seems like a different issue from existing reports, as it only appears in
the trunk version, not older versions like GCC 16 and earlier.
Thanks.