https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112929
--- Comment #14 from Patrick O'Neill <patrick at rivosinc dot com> --- I've reproduced the same failure on tip-of-tree using an old QEMU but cannot reproduce with a freshly built QEMU: GCC hash: eea25179d8d1406685b8b0995ba841605f895283 (tip-of-tree) Qemu hash: 78385bc738108a9b5b20e639520dc60425ca2a5a (v8.1.2) Glibc hash: a704fd9a133bfb10510e18702f48a6a9c88dbbd5 (v2.37) My QEMU was built with GCC hash: 8b5cd6c4519cc120badd2b35a9e30d4deb82c012 If I use the tip-of-tree to build QMEU the failure does not exist anymore. Your modified testcase does not produce the failure since it's missing the variadic function call. Here is a version that works for me and does not use printf: int a, l, i, p, q, t, n, o; int *volatile c; static int j; static struct pack_1_struct d; long e; char m = 5; short s; #pragma pack(1) struct pack_1_struct { long c; int d; int e; int f; int g; int h; int i; } h, r = {1}, *f = &h, *volatile g; void add_em_up(int count, ...) { __builtin_va_list ap; __builtin_va_start(ap, count); __builtin_va_end(ap); } int main() { int u; j = 0; for (; j < 9; ++j) { u = ++t ? a : 0; if (u) { int *v = &d.d; *v = g || e; *c = 0; *f = h; } s = l && c; o = i; d.f || (p = 0); q |= n; } r = *f; add_em_up(1, 1); if (m != 5) return 1; return 0; } Commands (Note that I used the old QEMU build): gcv: > /scratch/tc-testing/tc-dec-11-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 > /scratch/tc-testing/tc-dec-8-trunk/build-rv64gcv/bin/qemu-riscv64 rv64gcv.out > echo $? 1 gc: > /scratch/tc-testing/tc-dec-11-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 > /scratch/tc-testing/tc-dec-8-trunk/build-rv64gcv/bin/qemu-riscv64 rv64gc.out > > echo $? 0 I think you're right Robin - it has some interaction with QMEU. The QEMU with GCC r14-6339-g8b5cd6c4519 produces the error but the QEMU with the tip-of-tree GCC r14-6417-geea25179d8d does not produce the error.