https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126779
Bug ID: 126779
Summary: ICE: tree check: expected class 'type', have
'exceptional' (error_mark) in build_int_cst, at
tree.cc:1653 with -mno-sse2 and _Float16
Product: gcc
Version: 17.0
Status: UNCONFIRMED
Keywords: ice-on-invalid-code
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: zsojka at seznam dot cz
Target Milestone: ---
Host: x86_64-pc-linux-gnu
Target: x86_64-pc-linux-gnu
Created attachment 65288
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=65288&action=edit
reduced testcase
Compiler output:
$ x86_64-pc-linux-gnu-gcc -O -mno-sse2 testcase.c
testcase.c: In function 'foo':
testcase.c:3:1: error: invalid conversion from type '_Float16' without option
'-msse2'
3 | int foo() { (0 ?: f) || i; }
| ^~~
testcase.c:3:1: internal compiler error: tree check: expected class 'type',
have 'exceptional' (error_mark) in build_int_cst, at tree.cc:1653
0x2eccd5d internal_error(char const*, ...)
/repo/gcc-trunk/gcc/diagnostic-global-context.cc:787
0x93dc89 tree_class_check_failed(tree_node const*, tree_code_class, char
const*, int, char const*)
/repo/gcc-trunk/gcc/tree.cc:9268
0x94716f tree_class_check(tree_node*, tree_code_class, char const*, int, char
const*)
/repo/gcc-trunk/gcc/tree.h:3986
0x94716f build_int_cst(tree_node*, poly_int<1u, long>)
/repo/gcc-trunk/gcc/tree.cc:1653
0x11dccfd make_range(tree_node*, int*, tree_node**, tree_node**)
/repo/gcc-trunk/gcc/fold-const.cc:5465
0x11e3bb8 fold_range_test
/repo/gcc-trunk/gcc/fold-const.cc:6191
0x11e3bb8 fold_truth_andor
/repo/gcc-trunk/gcc/fold-const.cc:9638
0x11ca080 fold_binary_loc(unsigned long, tree_code, tree_node*, tree_node*,
tree_node*)
/repo/gcc-trunk/gcc/fold-const.cc:12069
0x11d02ce fold_build2_loc(unsigned long, tree_code, tree_node*, tree_node*,
tree_node*)
/repo/gcc-trunk/gcc/fold-const.cc:13730
0xf1edb2 c_fully_fold_internal
/repo/gcc-trunk/gcc/c/c-fold.cc:576
0xf1f6ab c_fully_fold(tree_node*, bool, bool*, bool)
/repo/gcc-trunk/gcc/c/c-fold.cc:124
0xe9603f c_process_expr_stmt(unsigned long, tree_node*)
/repo/gcc-trunk/gcc/c/c-typeck.cc:13900
0xe9631d c_finish_expr_stmt(unsigned long, tree_node*)
/repo/gcc-trunk/gcc/c/c-typeck.cc:13945
0xf0c86f c_parser_statement_after_labels
/repo/gcc-trunk/gcc/c/c-parser.cc:8558
0xf15096 c_parser_compound_statement_nostart
/repo/gcc-trunk/gcc/c/c-parser.cc:7958
0xf15317 c_parser_compound_statement
/repo/gcc-trunk/gcc/c/c-parser.cc:7172
0xf0c102 c_parser_declaration_or_fndef
/repo/gcc-trunk/gcc/c/c-parser.cc:3354
0xf1a90b c_parser_external_declaration
/repo/gcc-trunk/gcc/c/c-parser.cc:2256
0xf1b7b8 c_parser_translation_unit
/repo/gcc-trunk/gcc/c/c-parser.cc:2095
0xf1b7b8 c_parse_file()
/repo/gcc-trunk/gcc/c/c-parser.cc:31491
/repo/gcc-trunk/binary-trunk-20260810200257-ga7a008375aa-checking-yes-rtl-df-extra-nobootstrap-amd64/bin/../libexec/gcc/x86_64-pc-linux-gnu/17.0.0/cc1
-quiet -iprefix
/repo/gcc-trunk/binary-trunk-20260810200257-ga7a008375aa-checking-yes-rtl-df-extra-nobootstrap-amd64/bin/../lib/gcc/x86_64-pc-linux-gnu/17.0.0/
testcase.c -quiet -dumpdir a- -dumpbase testcase.c -dumpbase-ext .c -mno-sse2
-mtune=generic -march=x86-64 -O -o /tmp/cc1Mnn2Q.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.