[Bug c/106830] New: [13 Regression] ICE: in tree_to_uhwi, at tree.cc:6392 (from check_for_xor_used_as_pow)
zsojka at seznam dot cz
gcc-bugzilla@gcc.gnu.org
Mon Sep 5 05:28:55 GMT 2022
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106830
Bug ID: 106830
Summary: [13 Regression] ICE: in tree_to_uhwi, at tree.cc:6392
(from check_for_xor_used_as_pow)
Product: gcc
Version: 13.0
Status: UNCONFIRMED
Keywords: ice-on-valid-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
This happens randomly, and even valgrind doesn't show any uninitialised use.
Minor modifications to the testcase might cause the issue to disappear
Compiler output:
$ cat testcase.c
foo0_u16_0() {
(__int128)(18302628885633695743 << 4) ^ 0;
}
$ x86_64-pc-linux-gnu-gcc testcase.c -c # OK first time
testcase.c:1:1: warning: return type defaults to 'int' [-Wimplicit-int]
1 | foo0_u16_0() {
| ^~~~~~~~~~
testcase.c: In function 'foo0_u16_0':
testcase.c:2:14: warning: integer constant is so large that it is unsigned
2 | (__int128)(18302628885633695743 << 4) ^ 0;
| ^~~~~~~~~~~~~~~~~~~~
$ x86_64-pc-linux-gnu-gcc testcase.c -c # ICE second time
testcase.c:1:1: warning: return type defaults to 'int' [-Wimplicit-int]
1 | foo0_u16_0() {
| ^~~~~~~~~~
testcase.c: In function 'foo0_u16_0':
testcase.c:2:14: warning: integer constant is so large that it is unsigned
2 | (__int128)(18302628885633695743 << 4) ^ 0;
| ^~~~~~~~~~~~~~~~~~~~
testcase.c:2:3: internal compiler error: in tree_to_uhwi, at tree.cc:6392
2 | (__int128)(18302628885633695743 << 4) ^ 0;
| ^
0x80aeaf tree_to_uhwi(tree_node const*)
/repo/gcc-trunk/gcc/tree.cc:6392
0x80aeaf tree_to_uhwi(tree_node const*)
/repo/gcc-trunk/gcc/tree.cc:6390
0xe428ab check_for_xor_used_as_pow(unsigned int, tree_node*, unsigned int,
tree_node*)
/repo/gcc-trunk/gcc/c-family/c-warn.cc:3821
0xd68628 parser_build_binary_op(unsigned int, tree_code, c_expr, c_expr)
/repo/gcc-trunk/gcc/c/c-typeck.cc:3994
0xd8f63c c_parser_binary_expression
/repo/gcc-trunk/gcc/c/c-parser.cc:8083
0xd9072b c_parser_conditional_expression
/repo/gcc-trunk/gcc/c/c-parser.cc:7651
0xd90f74 c_parser_expr_no_commas
/repo/gcc-trunk/gcc/c/c-parser.cc:7565
0xd91221 c_parser_expression
/repo/gcc-trunk/gcc/c/c-parser.cc:10768
0xd919e7 c_parser_expression_conv
/repo/gcc-trunk/gcc/c/c-parser.cc:10807
0xda8f17 c_parser_statement_after_labels
/repo/gcc-trunk/gcc/c/c-parser.cc:6294
0xdab364 c_parser_compound_statement_nostart
/repo/gcc-trunk/gcc/c/c-parser.cc:5831
0xdab864 c_parser_compound_statement
/repo/gcc-trunk/gcc/c/c-parser.cc:5640
0xdad32a c_parser_declaration_or_fndef
/repo/gcc-trunk/gcc/c/c-parser.cc:2554
0xdb5373 c_parser_external_declaration
/repo/gcc-trunk/gcc/c/c-parser.cc:1789
0xdb5d8b c_parser_translation_unit
/repo/gcc-trunk/gcc/c/c-parser.cc:1662
0xdb5d8b c_parse_file()
/repo/gcc-trunk/gcc/c/c-parser.cc:23669
0xe172b1 c_common_parse_file()
/repo/gcc-trunk/gcc/c-family/c-opts.cc:1255
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
Another testcase:
$ cat testcase.c
typedef unsigned __int128 U;
U u = (U)(((U)0x8000000000000000 << 64 )) ^ 0;
$ x86_64-pc-linux-gnu-gcc testcase.c
testcase.c:2:1: internal compiler error: in tree_to_uhwi, at tree.cc:6392
2 | U u = (U)(((U)0x8000000000000000 << 64 )) ^ 0;
| ^
0x80aeaf tree_to_uhwi(tree_node const*)
/repo/gcc-trunk/gcc/tree.cc:6392
0x80aeaf tree_to_uhwi(tree_node const*)
/repo/gcc-trunk/gcc/tree.cc:6390
0xe428ab check_for_xor_used_as_pow(unsigned int, tree_node*, unsigned int,
tree_node*)
/repo/gcc-trunk/gcc/c-family/c-warn.cc:3821
0xd68628 parser_build_binary_op(unsigned int, tree_code, c_expr, c_expr)
/repo/gcc-trunk/gcc/c/c-typeck.cc:3994
0xd8f63c c_parser_binary_expression
/repo/gcc-trunk/gcc/c/c-parser.cc:8083
0xd9072b c_parser_conditional_expression
/repo/gcc-trunk/gcc/c/c-parser.cc:7651
0xd90f74 c_parser_expr_no_commas
/repo/gcc-trunk/gcc/c/c-parser.cc:7565
0xd97c3f c_parser_initializer
/repo/gcc-trunk/gcc/c/c-parser.cc:5234
0xd97c3f c_parser_initializer
/repo/gcc-trunk/gcc/c/c-parser.cc:5222
0xdac1d4 c_parser_declaration_or_fndef
/repo/gcc-trunk/gcc/c/c-parser.cc:2291
0xdb5373 c_parser_external_declaration
/repo/gcc-trunk/gcc/c/c-parser.cc:1789
0xdb5d8b c_parser_translation_unit
/repo/gcc-trunk/gcc/c/c-parser.cc:1662
0xdb5d8b c_parse_file()
/repo/gcc-trunk/gcc/c/c-parser.cc:23669
0xe172b1 c_common_parse_file()
/repo/gcc-trunk/gcc/c-family/c-opts.cc:1255
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.
$ x86_64-pc-linux-gnu-gcc -v
Using built-in specs.
COLLECT_GCC=/repo/gcc-trunk/binary-latest-amd64/bin/x86_64-pc-linux-gnu-gcc
COLLECT_LTO_WRAPPER=/repo/gcc-trunk/binary-trunk-r13-2393-20220904080942-g6832dd39d7b-checking-yes-rtl-df-extra-amd64/bin/../libexec/gcc/x86_64-pc-linux-gnu/13.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /repo/gcc-trunk//configure --enable-languages=c,c++
--enable-valgrind-annotations --disable-nls --enable-checking=yes,rtl,df,extra
--with-cloog --with-ppl --with-isl --build=x86_64-pc-linux-gnu
--host=x86_64-pc-linux-gnu --target=x86_64-pc-linux-gnu
--with-ld=/usr/bin/x86_64-pc-linux-gnu-ld
--with-as=/usr/bin/x86_64-pc-linux-gnu-as --disable-libstdcxx-pch
--prefix=/repo/gcc-trunk//binary-trunk-r13-2393-20220904080942-g6832dd39d7b-checking-yes-rtl-df-extra-amd64
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 13.0.0 20220904 (experimental) (GCC)
More information about the Gcc-bugs
mailing list