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

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Wed Jul 23 08:54:29 PDT 2014


https://issues.dlang.org/show_bug.cgi?id=12164

yebblies <yebblies at gmail.com> changed:

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

--- Comment #10 from yebblies <yebblies at 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.

--


More information about the Digitalmars-d-bugs mailing list