https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126169
Bug ID: 126169
Summary: ICE on valid code at -O3 with "-g -fPIC" on
x86_64-linux-gnu: Segmentation fault
Product: gcc
Version: 16.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: rtl-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: zhendong.su at inf dot ethz.ch
Target Milestone: ---
Compiler Explorer: https://godbolt.org/z/eb8EMjbMo
Note:
- fails: trunk
- works: 16.1 and earlier
[603] % gcctk -v
Using built-in specs.
COLLECT_GCC=gcctk
COLLECT_LTO_WRAPPER=/local/home/suz/suz-local/software/local/gcc-trunk/bin/../libexec/gcc/x86_64-pc-linux-gnu/17.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-trunk/configure --disable-bootstrap
--enable-checking=yes --prefix=/local/suz-local/software/local/gcc-trunk
--enable-sanitizers --enable-languages=c,c++,lto --disable-werror
--disable-multilib
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 17.0.0 20260708 (experimental) (GCC)
[604] %
[604] % gcctk -O3 -c -w -g -fPIC small.c
during RTL pass: vartrack
small.c: In function ālā:
small.c:77:1: internal compiler error: Segmentation fault
77 | }
| ^
0x27822eb internal_error(char const*, ...)
../../gcc-trunk/gcc/diagnostic-global-context.cc:787
0x12053c3 crash_signal
../../gcc-trunk/gcc/toplev.cc:325
0x7f58da8a251f ???
./signal/../sysdeps/unix/sysv/linux/x86_64/libc_sigaction.c:0
0xc82084 cselib_add_permanent_equiv(cselib_val*, rtx_def*, rtx_insn*)
../../gcc-trunk/gcc/cselib.cc:2984
0x15f50da reverse_op
../../gcc-trunk/gcc/var-tracking.cc:5948
0x15f50da add_stores
../../gcc-trunk/gcc/var-tracking.cc:6226
0x15f077f add_with_sets
../../gcc-trunk/gcc/var-tracking.cc:6649
0xc82e39 cselib_record_sets
../../gcc-trunk/gcc/cselib.cc:3237
0xc83ed2 cselib_process_insn(rtx_insn*)
../../gcc-trunk/gcc/cselib.cc:3409
0x15fe6e2 vt_initialize
../../gcc-trunk/gcc/var-tracking.cc:10300
0x1603f82 variable_tracking_main_1
../../gcc-trunk/gcc/var-tracking.cc:10528
0x160412f variable_tracking_main()
../../gcc-trunk/gcc/var-tracking.cc:10581
0x160412f execute
../../gcc-trunk/gcc/var-tracking.cc:10618
/local/home/suz/suz-local/software/local/gcc-trunk/bin/../libexec/gcc/x86_64-pc-linux-gnu/17.0.0/cc1
-quiet -I /usr/local/include -I /local/suz-local/software/local/include
-imultiarch x86_64-linux-gnu -iprefix
/local/home/suz/suz-local/software/local/gcc-trunk/bin/../lib/gcc/x86_64-pc-linux-gnu/17.0.0/
small.c -quiet -dumpbase small.c -dumpbase-ext .c -mtune=generic -march=x86-64
-g -O3 -w -fPIC -o /tmp/ccfkGi8s.s
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.
[605] %
[605] % cat small.c
extern float fmodf(float, float);
float b, c;
long h, i, k, *ab;
char j;
short m;
static __attribute__((noinline)) int a(int n, int p2) {
static int d[6];
for (int e = 0; e < 256; ++e)
d[e] = e;
int f = n;
f = d[f ^ p2];
return f;
}
int g(double, char) { return 0; }
void l(long n, int p2, char p) {
long o = 1, q, *t;
int r = 1, s;
ab = &o;
k = r = k;
if (0 >= p)
goto u;
goto v;
u:
r = n - o;
if ((9142 ^ r) >= 90 + r)
goto ac;
r = k ? k : 9039991.125f;
if (__builtin_isfinite(c))
__builtin_trap();
if (905969534 + (p << 24) < o)
goto v;
ac:
q = -o;
m = 6 - (p << 6);
if (q + 1073741825 ^ o + 7 & q)
goto af;
goto ae;
af:
if (__builtin_isfinite(c))
__builtin_trap();
*ab = 5 + o;
if (p2)
goto u;
if (__builtin_isfinite(b / b))
__builtin_trap();
c = 0 + fmodf(b, b);
if (o < n)
goto ag;
if (h)
goto af;
ae:
*t = k - 10992403549608;
q = 21285390711 * o - 403452967995;
if (q)
goto ah;
goto ai;
ah:
k = h + h % 490681911 - *t % 9283091488;
r = (int)(o >> 4) - 1321465791 - -2057527364 + 724134559;
if (p)
goto ai;
ag:
*t = j = g(0, p) ?: 81;
r = h;
if ((5275004732 | q - 80545797) - 9 / o)
goto ai;
v:
m = r = b;
ai:
s = q >> 4;
a(s, m);
s = a(s, 0);
s = a(s, r);
a(s, b);
s = (long)p2 >> a(s, p);
a(s, i);
}