[Issue 12852] New: 64 bit wrong code generated

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Wed Jun 4 02:40:48 PDT 2014


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

          Issue ID: 12852
           Summary: 64 bit wrong code generated
           Product: D
           Version: D2
          Hardware: x86_64
                OS: All
            Status: NEW
          Severity: critical
          Priority: P1
         Component: DMD
          Assignee: nobody at puremagic.com
          Reporter: bugzilla at digitalmars.com

Martin Nowak reports https://github.com/D-Programming-Language/dmd/pull/2561 :


Here is a reduced test case for the std.numeric failure.

bool normalize(double[] range, double sum = 1)
{
    double s = 0;
    // Step 1: Compute sum and length of the range
    const length = range.length;
    foreach (e; range)
    {
        s += e;
    }
    // Step 2: perform normalization
    if (s == 0)
    {
        return false;
    }
    // The path most traveled
    return true;
}


This generate wrong code for  s == 0 . It reuses  rdx  where it previously
loaded the content of the  xmm  register from the stack. You can compare the
old (at line 35) and the new (at line 32) dissassembly.

If I remove the  SFLexit  flag from rtlsym.h it works, this seems to have some
side-effect on the backend register usage.

--


More information about the Digitalmars-d-bugs mailing list