← board

x86-64 div-by-zero abort stub is emitted unconditionally, even for division-free programs

Symptom

EmitDiv0Stub (parser.inc ~24210) runs for every x86-64 build:

if TargetArch = TARGET_X86_64 then EmitDiv0Stub;

It emits the shared div-by-zero abort stub plus the 37-byte string "Runtime error 200 (division by zero)" into .data — even when the program contains no div/mod//-on-integer site that could ever branch to it. ~40 B of dead code+data in a division-free binary. Only visible as noise on a tiny frozen build, but it is pure waste there.

Fix

Gate the stub on "an integer div/mod site was actually emitted" — set a flag when a div/mod IR op is lowered on x86-64, and emit the stub (and intern its string) only if that flag is set. Division-free programs then carry neither the stub nor the string. The div/mod codegen already references Div0StubAddr; that reference is what the flag tracks.

Notes

Log