From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 17B783858CDB; Mon, 5 Sep 2022 05:28:56 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 17B783858CDB DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1662355736; bh=tluKjwm5K/+11a/lvoq60xAwqKYjeo3CP6wdAcDkS9I=; h=From:To:Subject:Date:From; b=h7iIDk+/IzlmnOcSt0sFboUkGj0ZYs0/bhctV07+yDiykrl/UvF/68PbTsS/FmHv3 HoEI9+LzO++fZSTdzKifN879xI1EVx5wR38J1ZC4/A1Qt0GRJXjYIg7zNaf5ME/bPi CMzFEM/sp3SuUFFcDv/GgJ1A38eFwRKYyg6uwngg= From: "zsojka at seznam dot cz" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/106830] New: [13 Regression] ICE: in tree_to_uhwi, at tree.cc:6392 (from check_for_xor_used_as_pow) Date: Mon, 05 Sep 2022 05:28:55 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c X-Bugzilla-Version: 13.0 X-Bugzilla-Keywords: ice-on-valid-code X-Bugzilla-Severity: normal X-Bugzilla-Who: zsojka at seznam dot cz X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status keywords bug_severity priority component assigned_to reporter target_milestone cf_gcchost cf_gcctarget Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D106830 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=20 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=20 typedef unsigned __int128 U; U u =3D (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 =3D (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 for instructions. $ x86_64-pc-linux-gnu-gcc -v Using built-in specs. COLLECT_GCC=3D/repo/gcc-trunk/binary-latest-amd64/bin/x86_64-pc-linux-gnu-g= cc COLLECT_LTO_WRAPPER=3D/repo/gcc-trunk/binary-trunk-r13-2393-20220904080942-= g6832dd39d7b-checking-yes-rtl-df-extra-amd64/bin/../libexec/gcc/x86_64-pc-l= inux-gnu/13.0.0/lto-wrapper Target: x86_64-pc-linux-gnu Configured with: /repo/gcc-trunk//configure --enable-languages=3Dc,c++ --enable-valgrind-annotations --disable-nls --enable-checking=3Dyes,rtl,df,= extra --with-cloog --with-ppl --with-isl --build=3Dx86_64-pc-linux-gnu --host=3Dx86_64-pc-linux-gnu --target=3Dx86_64-pc-linux-gnu --with-ld=3D/usr/bin/x86_64-pc-linux-gnu-ld --with-as=3D/usr/bin/x86_64-pc-linux-gnu-as --disable-libstdcxx-pch --prefix=3D/repo/gcc-trunk//binary-trunk-r13-2393-20220904080942-g6832dd39d= 7b-checking-yes-rtl-df-extra-amd64 Thread model: posix Supported LTO compression algorithms: zlib zstd gcc version 13.0.0 20220904 (experimental) (GCC)=