[Issue 18315] wrong code for `i > 0`
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sat Jan 27 14:47:33 UTC 2018
https://issues.dlang.org/show_bug.cgi?id=18315
ag0aep6g at gmail.com changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |wrong-code
--- Comment #1 from ag0aep6g at gmail.com ---
Whoops. Accidentally hit "submit".
This is what dmd generates for `i > 0`:
----
neg EAX
shr EAX,01Fh
----
In D: `(-i) >> 31`.
That code assumes that negation always flips the sign bit. But it doesn't for
`int.min`. `-int.min` is `int.min` again.
--
More information about the Digitalmars-d-bugs
mailing list