Thread overview
[Issue 12164] Function returning ptrdiff_t.min in 64-bit returning 0 when -O is set.
Jul 23, 2014
yebblies
July 23, 2014
https://issues.dlang.org/show_bug.cgi?id=12164

yebblies <yebblies@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull
           Hardware|All                         |x86_64
           Assignee|nobody@puremagic.com        |yebblies@gmail.com

--- Comment #10 from yebblies <yebblies@gmail.com> ---
Found it!

https://github.com/D-Programming-Language/dmd/pull/3805

ptrdiff_t.min was being truncated to 32-bits == 0 while trying to optimize the ternary operator it built out of the compare function.

The xor eax, eax was done by the pinhole optimizer working off the already broken code.

--
July 24, 2014
https://issues.dlang.org/show_bug.cgi?id=12164

--- Comment #11 from github-bugzilla@puremagic.com ---
Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/44b9d2735e58833115fcf4fb7f3cc4ba524e9159
Fix Issue 12164 - Function returning ptrdiff_t.min in 64-bit returning 0 when
-O is set

The trick used to optimize ?const:const doesn't work when you can't actually express the value as immediates.  They were silently truncated leading to incorrect results.

Values were also truncated due to a typo.

https://github.com/D-Programming-Language/dmd/commit/f4a8858f5dd2cf8a46917bae5cebade9c786d007 Merge pull request #3805 from yebblies/issue12164

Fix Issue 12164 - Function returning ptrdiff_t.min in 64-bit returning 0 when -O is set

--
July 24, 2014
https://issues.dlang.org/show_bug.cgi?id=12164

--- Comment #12 from github-bugzilla@puremagic.com ---
Commit pushed to dmd-1.x at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/56ed061f012cda411fdc2fcfea4d71ba906e4a2d
Fix Issue 12164 - Function returning ptrdiff_t.min in 64-bit returning 0 when
-O is set

--
July 31, 2014
https://issues.dlang.org/show_bug.cgi?id=12164

--- Comment #13 from github-bugzilla@puremagic.com ---
Commit pushed to 2.066 at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/be520148c02ad417a6fd5c8e98e6d56afb8e01ab Merge pull request #3805 from yebblies/issue12164

Fix Issue 12164 - Function returning ptrdiff_t.min in 64-bit returning 0 when -O is set

--
August 02, 2014
https://issues.dlang.org/show_bug.cgi?id=12164

--- Comment #14 from github-bugzilla@puremagic.com ---
Commits pushed to master at https://github.com/D-Programming-Language/phobos

https://github.com/D-Programming-Language/phobos/commit/f802ee6ce1dfe1e2725e6b27a218526aa696d740 Remove workaround for issue 12164.

https://github.com/D-Programming-Language/phobos/commit/9dc763d0f3a441bcd7f58a35b17b24423f2faca6 Merge pull request #2394 from Kapps/remove12164wa

Remove workaround for issue 12164.

--
August 22, 2014
https://issues.dlang.org/show_bug.cgi?id=12164

--- Comment #15 from github-bugzilla@puremagic.com ---
Commit pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/be520148c02ad417a6fd5c8e98e6d56afb8e01ab Merge pull request #3805 from yebblies/issue12164

--