public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/106830] New: [13 Regression] ICE: in tree_to_uhwi, at tree.cc:6392 (from check_for_xor_used_as_pow)
@ 2022-09-05  5:28 zsojka at seznam dot cz
  2022-09-05  9:11 ` [Bug c/106830] " jakub at gcc dot gnu.org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: zsojka at seznam dot cz @ 2022-09-05  5:28 UTC (permalink / raw)
  To: gcc-bugs

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)

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2022-09-22 12:41 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-05  5:28 [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
2022-09-05  9:11 ` [Bug c/106830] " jakub at gcc dot gnu.org
2022-09-05  9:11 ` jakub at gcc dot gnu.org
2022-09-05 10:12 ` [Bug c/106830] [13 Regression] ICE: in tree_to_uhwi, at tree.cc:6392 (from check_for_xor_used_as_pow) since r13-2386-gbedfca647a9e9c1a marxin at gcc dot gnu.org
2022-09-06  5:06 ` zsojka at seznam dot cz
2022-09-06 15:58 ` dmalcolm at gcc dot gnu.org
2022-09-07  1:24 ` dmalcolm at gcc dot gnu.org
2022-09-22 12:36 ` cvs-commit at gcc dot gnu.org
2022-09-22 12:41 ` dmalcolm at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).