[Issue 18315] wrong code for `i > 0`

2018-02-28 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18315

ag0ae...@gmail.com changed:

   What|Removed |Added

 CC||yebbl...@gmail.com

--- Comment #8 from ag0ae...@gmail.com ---
*** Issue 18001 has been marked as a duplicate of this issue. ***

--


[Issue 18315] wrong code for `i > 0`

2018-02-09 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18315

--- Comment #7 from github-bugzi...@puremagic.com ---
Commits pushed to master at https://github.com/dlang/dmd

https://github.com/dlang/dmd/commit/74904b6e43d0934f7fbcd2f966b04aaa58d4cde9
fix issue 18315 - wrong code for `i > 0`

`SBB reg,0` is needed to make this work. There's nothing platform specific
about it.

Also add comments explaining how this works.

https://github.com/dlang/dmd/commit/b4a86786619bcbbd52c9ecf2db4a75a5c3f52911
fixup! fix issue 18315 - wrong code for `i > 0`

https://github.com/dlang/dmd/commit/4ccde911c8131dc170212f9a2f6d926ba7bdbe80
Merge pull request #7841 from aG0aep6G/18315

fix issue 18315 - wrong code for `i > 0`

--


[Issue 18315] wrong code for `i > 0`

2018-02-09 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18315

github-bugzi...@puremagic.com changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED

--


[Issue 18315] wrong code for `i > 0`

2018-02-07 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18315

Steven Schveighoffer  changed:

   What|Removed |Added

Summary|wrong code for `int.min >   |wrong code for `i > 0`
   |0`  |

--- Comment #6 from Steven Schveighoffer  ---
Martin, the wrong code is for i > 0, not int.min > 0. int.min > 0 is folded to
false:
https://run.dlang.io/is/dvHi9a

--


[Issue 18315] wrong code for `i > 0`

2018-02-04 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18315

ag0ae...@gmail.com changed:

   What|Removed |Added

   Keywords||pull

--- Comment #5 from ag0ae...@gmail.com ---
https://github.com/dlang/dmd/pull/7841

--


[Issue 18315] wrong code for `i > 0`

2018-01-28 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18315

Martin Nowak  changed:

   What|Removed |Added

 CC||c...@dawg.eu

--- Comment #4 from Martin Nowak  ---
Check cdcmp
https://github.com/dlang/dmd/blob/62e615bf79f49ccd8c1ab45d6c38b956d2895c21/src/dmd/backend/cod4.c#L2066

--


[Issue 18315] wrong code for `i > 0`

2018-01-27 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18315

Stefan  changed:

   What|Removed |Added

 CC||kde...@vogtner.de

--


[Issue 18315] wrong code for `i > 0`

2018-01-27 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18315

Vladimir Panteleev  changed:

   What|Removed |Added

   Hardware|x86_64  |All

--


[Issue 18315] wrong code for `i > 0`

2018-01-27 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18315

Steven Schveighoffer  changed:

   What|Removed |Added

 CC||schvei...@yahoo.com

--- Comment #2 from Steven Schveighoffer  ---
Wow, this is really old. Tested all the way back to 2.040, still fails.

--


[Issue 18315] wrong code for `i > 0`

2018-01-27 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18315

Steven Schveighoffer  changed:

   What|Removed |Added

 OS|Linux   |All

--- Comment #3 from Steven Schveighoffer  ---
Also fails on MacosX.

--


[Issue 18315] wrong code for `i > 0`

2018-01-27 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18315

ag0ae...@gmail.com changed:

   What|Removed |Added

   Keywords||wrong-code

--- Comment #1 from ag0ae...@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.

--