https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104644
Bug ID: 104644 Summary: [12 Regression] ICE: SIGSEGV (infinite recursion in fold_binary_loc / fold_build2_loc / generic_simplify_NE_EXPR) Product: gcc Version: 12.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 Created attachment 52493 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=52493&action=edit reduced testcase Compiler output: $ x86_64-pc-linux-gnu-gcc testcase.c -wrapper valgrind,-q testcase.c: In function 'foo': testcase.c:4:29: warning: overflow in conversion from 'float' to 'short unsigned int' changes value from '1.31072e+5f' to '65535' [-Woverflow] 4 | return __builtin_bswap16 ((float) 0x20000) != (char) (float) 0x20000; | ^~~~~~~~~~~~~~~ ==21462== Stack overflow in thread #1: can't grow stack to 0x1ffe001000 ==21462== Can't extend stack to 0x1ffe000e48 during signal delivery for thread 1: ==21462== no stack segment ==21462== ==21462== Process terminating with default action of signal 11 (SIGSEGV) ==21462== Access not within mapped region at address 0x1FFE000E48 ==21462== Stack overflow in thread #1: can't grow stack to 0x1ffe001000 ==21462== at 0xE22224: ggc_internal_alloc(unsigned long, void (*)(void*), unsigned long, unsigned long) (ggc-page.cc:1278) ==21462== If you believe this happened as a result of a stack ==21462== overflow in your program's main thread (unlikely but ==21462== possible), you can try to increase the size of the ==21462== main thread stack using the --main-stacksize= flag. ==21462== The main thread stack size used in this run was 16777216. x86_64-pc-linux-gnu-gcc: internal compiler error: Segmentation fault signal terminated program valgrind Please submit a full bug report, with preprocessed source (by using -freport-bug). See <https://gcc.gnu.org/bugs/> for instructions. (gdb) bt #0 generic_simplify_113 (loc=2147483649, type=0x7ffff76c35e8, captures=0x7ffffbfff090, cmp=NE_EXPR, bswap=CFN_BUILT_IN_BSWAP16, _p1=<optimized out>, _p0=<optimized out>) at generic-match.cc:6558 #1 0x0000000001afd8db in generic_simplify_NE_EXPR (loc=2147483649, type=0x7ffff76c35e8, _p0=0x7ffff70c7620, _p1=0x7ffff77f2510, code=NE_EXPR) at generic-match.cc:61429 #2 0x0000000000fe500f in fold_binary_loc (loc=2147483649, code=NE_EXPR, type=0x7ffff76c35e8, op0=0x7ffff70c7620, op1=0x7ffff77f2510) at /repo/gcc-trunk/gcc/fold-const.cc:10862 #3 0x0000000000fedb6a in fold_build2_loc (loc=2147483649, code=NE_EXPR, type=0x7ffff76c35e8, op0=0x7ffff70c7620, op1=0x7ffff77f2510) at /repo/gcc-trunk/gcc/fold-const.cc:13814 #4 0x0000000000fedb6a in fold_build2_loc (loc=2147483649, code=NE_EXPR, type=0x7ffff76c35e8, op0=0x7ffff77f2510, op1=0x7ffff70c7620) at /repo/gcc-trunk/gcc/fold-const.cc:13814 #5 0x0000000001afd8db in generic_simplify_NE_EXPR (loc=2147483649, type=0x7ffff76c35e8, _p0=0x7ffff70c75e8, _p1=0x7ffff77f24f8, code=NE_EXPR) at generic-match.cc:61429 #6 0x0000000000fe500f in fold_binary_loc (loc=2147483649, code=NE_EXPR, type=0x7ffff76c35e8, op0=0x7ffff70c75e8, op1=0x7ffff77f24f8) at /repo/gcc-trunk/gcc/fold-const.cc:10862 #7 0x0000000000fedb6a in fold_build2_loc (loc=2147483649, code=NE_EXPR, type=0x7ffff76c35e8, op0=0x7ffff70c75e8, op1=0x7ffff77f24f8) at /repo/gcc-trunk/gcc/fold-const.cc:13814 #8 0x0000000000fedb6a in fold_build2_loc (loc=2147483649, code=NE_EXPR, type=0x7ffff76c35e8, op0=0x7ffff77f24f8, op1=0x7ffff70c75e8) at /repo/gcc-trunk/gcc/fold-const.cc:13814 #9 0x0000000001afd8db in generic_simplify_NE_EXPR (loc=2147483649, type=0x7ffff76c35e8, _p0=0x7ffff70c75b0, _p1=0x7ffff77f2510, code=NE_EXPR) at generic-match.cc:61429 ... $ 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-r12-7349-20220222175310-g54f74502327-checking-yes-rtl-df-extra-nobootstrap-amd64/bin/../libexec/gcc/x86_64-pc-linux-gnu/12.0.1/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 --disable-bootstrap --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-r12-7349-20220222175310-g54f74502327-checking-yes-rtl-df-extra-nobootstrap-amd64 Thread model: posix Supported LTO compression algorithms: zlib zstd gcc version 12.0.1 20220222 (experimental) (GCC)