https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123674
Bug ID: 123674
Summary: ICE at -O1 with PGO: verify_flow_info failed (error:
verify_flow_info: REG_BR_PROB does not match cfg
264688980 264688977)
Product: gcc
Version: 16.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: xintong.zhou1 at uwaterloo dot ca
Target Milestone: ---
Created attachment 63385
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=63385&action=edit
The profile for bug reproduction.
The ICE happens when I use the attached profile to compile small.c with PGO.
Both the test program and profile are reduced as much as possible. To reproduce
the ICE, put the profile (gcc-trunk.out-small.gcda) in the same directory as
small.c and compile as follows.
$ gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/home/x27zhou/compiler-nightly/install/gcc/libexec/gcc/x86_64-pc-linux-gnu/16.0.1/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /home/x27zhou/compiler-nightly/src/gcc/configure
--enable-checking=yes --disable-bootstrap --disable-multilib
--enable-languages=c,c++ --prefix=/home/x27zhou/compiler-nightly/install/gcc
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 16.0.1 20260118 (experimental) (GCC)
$
$
$ gcc-trunk -O1 -fprofile-use -fprofile-correction -Wno-missing-profile
-Wno-coverage-mismatch -o gcc-trunk.out small.c
small.c: In function ‘func_35’:
small.c:70:16: warning: iteration 2147483644 invokes undefined behavior
[-Waggressive-loop-optimizations]
70 | for (; i; i++)
| ~^~
small.c:70:12: note: within this loop
70 | for (; i; i++)
| ^
small.c:155:1: error: verify_flow_info: REG_BR_PROB does not match cfg
264688980 264688977
155 | }
| ^
during RTL pass: loop2_unroll
small.c:155:1: internal compiler error: verify_flow_info failed
0x23aa65f internal_error(char const*, ...)
/home/x27zhou/compiler-nightly/src/gcc/gcc/diagnostic-global-context.cc:787
0x9eccf6 verify_flow_info()
/home/x27zhou/compiler-nightly/src/gcc/gcc/cfghooks.cc:290
0xee12b0 execute_function_todo(function*, void*)
/home/x27zhou/compiler-nightly/src/gcc/gcc/passes.cc:2112
0xedfb81 execute_todo(unsigned int)
/home/x27zhou/compiler-nightly/src/gcc/gcc/passes.cc:2152
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.
$
$
$ cat small.c
#include <stdint.h>
struct a {
unsigned b;
volatile unsigned c;
} n, o, u, y;
struct d {
int32_t b;
int64_t c;
int32_t e;
};
int32_t f, d, bm, bg, be, au, ar, ap, an, am, al, ag, ab, v, s, q, m, l, k, r,
g;
volatile struct d h;
uint8_t p;
uint32_t t[1][1];
uint8_t w[1][1];
int64_t x[1][1][1];
volatile struct a aa;
long ai, ak, aq, at, av, ax, ay, az, ba, bb;
static int8_t(z)(int8_t, int8_t) {}
static int16_t(ac)(int16_t, int16_t) {}
static int16_t(ad)(int16_t, int16_t) {}
static int16_t(ah)(int16_t, int) {}
static int16_t(aj)(int16_t, int) {}
int32_t(ao)(int32_t as, int aw) { return as < 0 || aw ?: aw; }
static uint8_t(bc)(uint8_t, uint8_t) {}
uint8_t(bd)(uint8_t, int aw) { return (aw >= 2) >> aw; }
static uint16_t(bf)(uint16_t, uint16_t) {}
static uint32_t(bi)(uint32_t) {}
uint32_t(br)(uint32_t bv, uint32_t ca) { return bv + ca; }
static uint32_t(cb)(uint32_t, int) {}
static uint64_t(cd)(uint64_t, uint64_t) {}
static const uint32_t ae(uint32_t, uint32_t, uint16_t, uint64_t, int64_t);
static int16_t af(uint32_t);
static int32_t func_35(uint32_t, uint64_t);
static uint32_t bh() {
for (; f; ae(f, f, 0, g, f))
;
}
const uint32_t ae(uint32_t, uint32_t, uint16_t, uint64_t bj, int64_t) {
af(bj);
}
int16_t af(uint32_t bk) {
int16_t bl = ai;
func_35(bl, bk);
}
int32_t func_35(uint32_t bn, uint64_t bo) {
int32_t bp = 7;
int32_t bq[3];
int16_t bs = 9;
int32_t bt;
int32_t bu = 4;
struct d bw;
int i, j;
for (i = 0; i < 3; i++)
bq;
for (; i; i++)
;
bq[1] = (bp || ak) && bn;
if (bn) {
int32_t bx;
for (; al && (ag || bm); bn++)
;
unsigned by = 0;
for (p = 0; p <= am && (ag || ++by <= 500); p = br(p, an))
q = ao(1 & bo, bd(bp, ap));
bx = bn;
} else {
uint16_t bz[7][6][6] = {};
for (; i; i++)
;
for (;;) {
if (bi((aq || (bf(ac(0, bn) || bz[4][3][4], n.b), u.b), 1)) || bq[0])
for (bt = 0;; bt++)
for (r = 2; r;)
return bz[0][r][bt];
if (aj(9, bz[4][3][4]))
if (t[6][3])
break;
return bu;
}
for (l = 0;;) {
for (; i; i++)
;
return t[bu][0];
}
}
unsigned cc = 0;
for (bp = ar; bp && (ag || ++cc);) {
int16_t ce = at;
for (; i; i++)
;
unsigned cf = 0;
for (v = 0; au && (ag || ++cf);) {
if (bo)
break;
for (; bs; bs++)
for (bw.b = 0; bw.b; bw.b++)
q || cd(0, 1) || h.b;
if (av) {
if (ax) {
for (; i; i++)
;
ay &&y.c;
h.e = ah(cd(ao(az || bo, bo) && x[2][2][2], bo), 0);
bc((ba || o.b) | s || bb, 3);
q = 0;
} else
for (; bs; bs--)
;
for (bw.e = 0; bw.e; --bw.e)
;
} else
ab = z(ad(cb(0, 0) || bn, n.b), r);
}
if ((bo || bn) != m) {
for (; i; i++)
;
w[0][2] && y.b;
} else {
int32_t cg = 3;
int32_t ch[3];
for (; i;)
ch[i] = d;
unsigned ci = 0;
for (; be && (ag || ++ci);)
if (bn) {
for (; i; i++)
for (j = 0; j < 1; j++)
;
bc(0, cg) && aa.b;
if (bo)
r = 0;
else {
if (ce)
break;
if (bn)
break;
if (bo)
continue;
}
} else {
for (; i; i++)
;
unsigned cj = 0;
for (; bw.c && (ag || ++cj); bw.c = bg)
;
}
br((bo && n.c, ch[1]) && k, 0);
}
}
for (l = 0; l; l = 6)
;
return bn;
}
int main() { bh(); }