[Issue 9264] New: [64bit] Wrong code with conversion from int parameter to float

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Jan 3 03:56:08 PST 2013


http://d.puremagic.com/issues/show_bug.cgi?id=9264

           Summary: [64bit] Wrong code with conversion from int parameter
                    to float
           Product: D
           Version: D1 & D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: critical
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: clugdbug at yahoo.com.au


--- Comment #0 from Don <clugdbug at yahoo.com.au> 2013-01-03 03:56:07 PST ---
float foo(float f) { return f*1.0f; }
float bar ()  { return 0.2; }

float bug9264 ( int x )
{
            return bar() * foo( x );
}
----

_D3zug7bug9264FiZf:
        push    RBP
        mov    RBP,RSP
        sub    RSP,030h
        mov    -010h[RBP],EDI
        call      _D3zug3barFZf at PC32
        movsd    -020h[RBP],XMM0
        sub    RSP,8                   <---------- PROBLEM HERE
        mov    EAX,-010h[RBP]
        cvtsi2ss    XMM0,EAX
        call      _D3zug3fooFfZf at PC32
        movss    -030h[RBP],XMM0
        movss    XMM1,-030h[RBP]
        add    RSP,8
        movsd    XMM0,-020h[RBP]
        mulss    XMM0,XMM1
        leave
        ret
.text._D3zug7bug9264FiZf    ends
---
The problem is that the sub RSP, 8 leaves the stack misaligned. It needs to be
aligned to 16 bytes.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list