https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123169
--- Comment #1 from Zhendong Su <zhendong.su at inf dot ethz.ch> --- Here is another possibly related repro that only fails at 15.2 and trunk, but not 15.1 and earlier. Compiler Explorer: https://godbolt.org/z/dWvfhxM1c [566] % 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/16.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++ --disable-werror --enable-multilib Thread model: posix Supported LTO compression algorithms: zlib gcc version 16.0.0 20251216 (experimental) (GCC) [567] % [567] % gcctk -O3 small.c; ./a.out [568] % [568] % gcctk -O3 -fschedule-insns small.c [569] % ./a.out Segmentation fault [570] % [570] % cat small.c int a[256], f, g, c, d, i, k[] = {-1, -1, -2, -1, -1, 1, -2, -1, -1}, l[1], m[] = {1, -1, -1, -6}, n[] = {1, -1, -1, -6}, o[2], p[2], q[] = {1}, (*r)[3][1] = (int (*)[][1])q, s[] = {1, -1, -1, -6}; int v(int w, unsigned y) { return (w >> 8 & 16777215) ^ a[(w ^ y) & 255]; } int z(int w, int y) { f = (w >> 8 & 16777215) ^ a[(w ^ y) & 255]; w = f; w = v(w, y >> 8 & 255); w = v(w, y >> 6); w = v(w, y >> 4); return w; } int aa(int w, int y[]) { unsigned b = 4294967295; int h = 0; for (; h < w; ++h) b = z(b, y[h]); b = (b ^ 4294967295) % 2147483647; return b; } int ab(int w, int y[][2], int ac, int ad, int ae) { ac = 1 - 5; if (y[0][0]) goto r; q: y[1][1] = -ac - 90; w = y[0][0]; if (!(7 % w - ac)) goto t; ac = 30 % g + (4 - w); w = 6 * w + y[1][1]; if (w - (2 - ae)) goto q; u: if (ae - w) goto q; r: if (y[1][1] == 0) goto u; t: y[0][0] = 1 % ac - 1 % ae - -1; w = -ac + 1 / ad - 1; int x[] = {w, y[0][0], y[0][1], y[1][0], y[1][1], g, ac, ad, ae}; return aa(9, x); } int af(int w[][3], int y, int ac, int ad, int ae[]) { w[1][2] = ab(1, (int(*)[])n, 1, -2, -2) - 1146702283 - (-ad - 1); c = -3 % ad - 1; ae[0] = ab(1, (int(*)[])n, 1, -2, -2) - 1146702285 - 1 - 1; int t[] = {w[0][0], w[0][1], w[0][2], w[1][0], w[1][1], w[1][2], w[2][0], w[2][1], w[2][2], y, ac, c, ad, ae[0]}; return aa(14, t); } int ag(int w[], int y, int ac, int ad) { ad = ab(1, (int(*)[])m, 1, -2, -2) - 1146702285 + ad; d = -ad - (-1 + ac - 3); ac = 9 - 1 - d - 1; i = af((int(*)[])k, -1, 2, 2, l) - 1148806649; d = w[0] = -1 - 1; int u[] = {w[0], w[1], y, ac, ad, i, d}; return aa(7, u); } int main() { for (int h = 0; h < 256; h++) { unsigned e = h; for (int j = 8; j; j--) if (e & 1) e = e >> 1 ^ 3988292384; else e >>= 1; a[h] = e; } while (1) { if (r[0][ag(o, -1, -1, -1) - 564098273] [ab(-1, (int(*)[])s, 1, -2, -2) - 1146702284]) return 0; ab(-1, (int(*)[])p, 1, 2, 2); } }
