Fixes codegen bug with literal negative zero, fixes #7079 (#7158)

* Fixes #7079

* Fix handling of neg zero during constant folding
This commit is contained in:
GULPF 2018-01-31 16:29:42 +01:00 • committed by Andreas Rumpf
commit 94038545be
4 changed files with 31 additions and 11 deletions

View file

@ -225,6 +225,7 @@ proc evalOp(m: TMagic, n, a, b, c: PNode): PNode =
of mDivF64:
if getFloat(b) == 0.0:
if getFloat(a) == 0.0: result = newFloatNodeT(NaN, n)
elif getFloat(b).classify == fcNegZero: result = newFloatNodeT(-Inf, n)
else: result = newFloatNodeT(Inf, n)
else:
result = newFloatNodeT(getFloat(a) / getFloat(b), n)