View mode: basic / threaded / horizontal-split · Log in · Help
January 03, 2013
[Issue 9264] New: [64bit] Wrong code with conversion from int parameter to float
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@puremagic.com
       ReportedBy: clugdbug@yahoo.com.au


--- Comment #0 from Don <clugdbug@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@PC32
       movsd    -020h[RBP],XMM0
       sub    RSP,8                   <---------- PROBLEM HERE
       mov    EAX,-010h[RBP]
       cvtsi2ss    XMM0,EAX
       call      _D3zug3fooFfZf@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: -------
January 03, 2013
[Issue 9264] [64bit] Wrong code with conversion from int parameter to float
http://d.puremagic.com/issues/show_bug.cgi?id=9264


Don <clugdbug@yahoo.com.au> changed:

          What    |Removed                     |Added
----------------------------------------------------------------------------
            Status|NEW                         |RESOLVED
        Resolution|                            |FIXED


--- Comment #1 from Don <clugdbug@yahoo.com.au> 2013-01-03 04:00:58 PST ---
But it looks as though this is already fixed in git head, before the release of
1.076 and 2.061.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
January 03, 2013
[Issue 9264] [64bit] Wrong code with conversion from int parameter to float
http://d.puremagic.com/issues/show_bug.cgi?id=9264



--- Comment #2 from Don <clugdbug@yahoo.com.au> 2013-01-03 04:18:45 PST ---
Fixed in D1 commit 0726201e5bea65426ae2075280e4eb76b29ea6e8
Dec 24.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
January 03, 2013
[Issue 9264] [64bit] Wrong code with conversion from int parameter to float
http://d.puremagic.com/issues/show_bug.cgi?id=9264


Walter Bright <bugzilla@digitalmars.com> changed:

          What    |Removed                     |Added
----------------------------------------------------------------------------
                CC|                            |bugzilla@digitalmars.com
          Platform|All                         |x86_64
        Resolution|FIXED                       |WORKSFORME


--- Comment #3 from Walter Bright <bugzilla@digitalmars.com> 2013-01-03 10:15:46 PST ---
"Already fixed" issues should be resolved as "WORKSFORME", otherwise the
changelog fills up with duplicates.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
January 04, 2013
[Issue 9264] [64bit] Wrong code with conversion from int parameter to float
http://d.puremagic.com/issues/show_bug.cgi?id=9264


Don <clugdbug@yahoo.com.au> changed:

          What    |Removed                     |Added
----------------------------------------------------------------------------
        Resolution|WORKSFORME                  |FIXED


--- Comment #4 from Don <clugdbug@yahoo.com.au> 2013-01-04 07:21:34 PST ---
(In reply to comment #3)
> "Already fixed" issues should be resolved as "WORKSFORME", otherwise the
> changelog fills up with duplicates.

I marked it as FIXED deliberately. This was a really hideous bug, it caused
intermittent hardware exceptions deep in C library code, and it took more than
a week to track down. This is not a duplicate of anything in Bugzilla.

It's awesome that you noticed the bug in the source code and fixed it in the
compiler release, just a few hours before we entered it into bugzilla. But it's
not clear from the git log just what a critical bugfix it was.

It most definitely needs to appear in the changelog.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Top | Discussion index | About this forum | D home