https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113087
Bug ID: 113087 Summary: [14] RISC-V rv64gcv vector: Runtime mismatch with rv64gc Product: gcc Version: 14.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: patrick at rivosinc dot com Target Milestone: --- Sorry for the non-descriptive issue title - I'm not sure what's going on here. Testcase: int(e)(int g, int h) { return h > 0x10 || g > 0xFFFFFFFF >> h ? g : g << h; } struct i { int j; int l : 1; }; struct m { char k; int n; }; char o; char p; short s; int q; struct m r; int v; int t; short z; long ac; int ad; int ae; static void ai(struct i bf) { for (; v; v++) r.k = 0; do ac ^= bf.j; while (bf.j < 0); s = 0; if (bf.l) q |= 0x800; } int main() { struct i aw = {0xE00, 1}; o = 4; s = p; ai(aw); t = 1; ++p; for (; t <= 7; t++) { ad &= 1; (o &= 1 - e(0x40000012, ++ae)) & (z |= 1); } for (; r.n;) ; if (o != 4) return 1; } Analysis: o = 4; ... Ignore first 7 iterations of loop, only consider last iter (ae = 7) o &= 1 - e(0x40000012, ++ae) expanded: o = 4 & (1 - e(0x40000012, 8)) expanded: o = 4 & (1 - (8 > 0x10 || 0x40000012 > 0xFFFFFFFF >> 8 ? 0x40000012 : 0x40000012 << 8)) partially evaluated: o = 4 & (1 - (false || 0x40000012 > 0xFFFFFF ? 0x40000012 : 0x...1200)) partially evaluated: o = 4 & (1 - (false || true ? 0x40000012 : 0x...1200)) partially evaluated: o = 4 & (1 - (true ? 0x40000012 : 0x...1200)) partially evaluated: o = 4 & (1 - (0x40000012)) partially evaluated: o = 4 & (0xBFFFFFEF) evaluated: o = 4 Commands: > /scratch/tc-testing/tc-dec-19-trunk/build-rv64gcv/bin/riscv64-unknown-linux-gnu-gcc > -march=rv64gcv -mabi=lp64d -O3 red.c -o rv64gcv.out > QEMU_CPU=rv64,vlen=128,v=true,vext_spec=v1.0,Zve32f=true,Zve64f=true timeout > --verbose -k 0.1 1 > /scratch/tc-testing/tc-dec-19-trunk/build-rv64gcv/bin/qemu-riscv64 rv64gcv.out > echo $? 1 > /scratch/tc-testing/tc-dec-19-trunk/build-rv64gcv/bin/riscv64-unknown-linux-gnu-gcc > -march=rv64gc -mabi=lp64d -O3 red.c -o rv64gc.out > QEMU_CPU=rv64,vlen=128,v=true,vext_spec=v1.0,Zve32f=true,Zve64f=true timeout > --verbose -k 0.1 1 > /scratch/tc-testing/tc-dec-19-trunk/build-rv64gcv/bin/qemu-riscv64 rv64gc.out > echo $? 0 Behavior found using gcc hash: r14-6716-g1502d724df8