← board

csmith -O0 miscompile (seed 31039): wrong g_22 checksum

Symptom

gcc -O0            : checksum = 6522DF69
pxx (all -O levels): checksum = A988DFF7   (wrong)

The checksummed global is int16_t g_22. It is mutated through two nested-function sites ((*l_21) ^= ... in func_1's argument list, then (*l_89) = safe_sub(...) inside func_2, which is CALLED from that same argument list) — so the final value depends on side-effect ordering across a nested call plus pointer chains (int8_t **, int8_t ***) and safe_math wrappers.

Reproduce

tools/csmith_fuzz.py --seed 31039 --csmith-args "--max-funcs 2 --max-array-dim 3 --max-pointer-depth 3"

Reproducer (this box's csmith) + a 90-line line-reduced form preserved in the session scratchpad (MISCOMPILE_VS_GCC-31039/, reduced31039.c).

Status

Acceptance

Log