https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114084
Bug ID: 114084
Summary: ICE: SIGSEGV: infinite recursion in fold_build2_loc /
fold_binary_loc with _BitInt(127)
Product: gcc
Version: 14.0
Status: UNCONFIRMED
Keywords: ice-on-valid-code
Severity: normal
Priority: P3
Component: tree-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: zsojka at seznam dot cz
CC: jakub at gcc dot gnu.org
Target Milestone: ---
Host: x86_64-pc-linux-gnu
Target: x86_64-pc-linux-gnu
Created attachment 57518
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=57518&action=edit
reduced testcase
Compiler output:
$ x86_64-pc-linux-gnu-gcc testcase.c -wrapper gdb,-q,--args
Reading symbols from
/repo/gcc-trunk/binary-trunk-r14-9151-20240223113818-g22121546e03-checking-yes-rtl-df-extra-amd64/bin/../libexec/gcc/x86_64-pc-linux-gnu/14.0.1/cc1...
(gdb) r
Starting program:
/repo/gcc-trunk/binary-trunk-r14-9151-20240223113818-g22121546e03-checking-yes-rtl-df-extra-amd64/libexec/gcc/x86_64-pc-linux-gnu/14.0.1/cc1
-quiet -iprefix
/repo/gcc-trunk/binary-trunk-r14-9151-20240223113818-g22121546e03-checking-yes-rtl-df-extra-amd64/bin/../lib/gcc/x86_64-pc-linux-gnu/14.0.1/
testcase.c -quiet -dumpdir a- -dumpbase testcase.c -dumpbase-ext .c
-mtune=generic -march=x86-64 -o /tmp/ccRiFgDu.s
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
Program received signal SIGSEGV, Segmentation fault.
wi::fits_to_tree_p<poly_int<1u, generic_wide_int<wide_int_ref_storage<false,
true> > > > (x=..., type=type@entry=0x7ffff75b15e8) at
/repo/gcc-trunk/gcc/tree.h:6620
6620 return known_eq (x, zext (x, TYPE_PRECISION (type)));
(gdb) bt
#0 wi::fits_to_tree_p<poly_int<1u,
generic_wide_int<wide_int_ref_storage<false, true> > > > (x=...,
type=type@entry=0x7ffff75b15e8) at /repo/gcc-trunk/gcc/tree.h:6620
#1 0x0000000001846c63 in force_fit_type (type=0x7ffff75b15e8, cst=...,
overflowable=1, overflowed=<optimized out>) at /repo/gcc-trunk/gcc/tree.cc:1563
#2 0x00000000010f2f3a in fold_convert_const_int_from_int (type=0x7ffff75b15e8,
arg1=0x7ffff75ad7c0) at /repo/gcc-trunk/gcc/fold-const.cc:2173
#3 fold_convert_const (code=<optimized out>, type=0x7ffff75b15e8,
arg1=0x7ffff75ad7c0) at /repo/gcc-trunk/gcc/fold-const.cc:2467
#4 0x0000000001109095 in fold_unary_loc (loc=2147483656, code=NOP_EXPR,
type=0x7ffff75b15e8, op0=0x7ffff75ad7c0) at
/repo/gcc-trunk/gcc/fold-const.cc:9489
#5 0x000000000110b80a in fold_build1_loc (loc=loc@entry=2147483656,
code=code@entry=NOP_EXPR, type=0x7ffff75b15e8, op0=0x7ffff75ad7c0) at
/repo/gcc-trunk/gcc/fold-const.cc:14110
#6 0x0000000001d76ec2 in generic_simplify_93 (loc=loc@entry=2147483656,
type=type@entry=0x7ffff75b1540, _p0=_p0@entry=0x7ffff656d900,
_p1=_p1@entry=0x7ffff75ad7c0,
captures=captures@entry=0x7ffffbfff670, bitop=bitop@entry=BIT_IOR_EXPR) at
generic-match-5.cc:561
#7 0x0000000001da2de5 in generic_simplify_BIT_IOR_EXPR (loc=2147483656,
code=<optimized out>, type=0x7ffff75b1540, _p0=0x7ffff656d900,
_p1=0x7ffff75ad7c0) at generic-match-6.cc:5599
#8 0x0000000001100576 in fold_binary_loc (loc=2147483656, code=BIT_IOR_EXPR,
type=0x7ffff75b1540, op0=0x7ffff656d900, op1=0x7ffff75ad7c0) at
/repo/gcc-trunk/gcc/fold-const.cc:11292
#9 0x000000000110810b in fold_build2_loc (loc=2147483656, code=BIT_IOR_EXPR,
type=0x7ffff75b1540, op0=0x7ffff656d900, op1=0x7ffff75ad7c0) at
/repo/gcc-trunk/gcc/fold-const.cc:14156
#10 0x000000000110157d in fold_binary_loc (loc=<optimized out>,
code=BIT_IOR_EXPR, type=0x7ffff75b1540, op0=<optimized out>, op1=<optimized
out>) at /repo/gcc-trunk/gcc/fold-const.cc:11836
#11 0x000000000110810b in fold_build2_loc (loc=2147483656, code=BIT_IOR_EXPR,
type=0x7ffff75b1540, op0=0x7ffff75afc58, op1=0x7ffff656d8c0) at
/repo/gcc-trunk/gcc/fold-const.cc:14156
#12 0x0000000001101626 in fold_binary_loc (loc=<optimized out>, code=<optimized
out>, type=0x7ffff75b1540, op0=<optimized out>, op1=<optimized out>)
at /repo/gcc-trunk/gcc/fold-const.cc:11868
#13 0x000000000110810b in fold_build2_loc (loc=2147483656, code=BIT_IOR_EXPR,
type=0x7ffff75b1540, op0=0x7ffff75afc58, op1=0x7ffff656d840) at
/repo/gcc-trunk/gcc/fold-const.cc:14156
#14 0x0000000001101626 in fold_binary_loc (loc=<optimized out>, code=<optimized
out>, type=0x7ffff75b1540, op0=<optimized out>, op1=<optimized out>)
at /repo/gcc-trunk/gcc/fold-const.cc:11868
...
$ 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-r14-9151-20240223113818-g22121546e03-checking-yes-rtl-df-extra-amd64/bin/../libexec/gcc/x86_64-pc-linux-gnu/14.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
--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-r14-9151-20240223113818-g22121546e03-checking-yes-rtl-df-extra-amd64
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 14.0.1 20240223 (experimental) (GCC)