Thanks, Brad & Don. Commit 882.

Brad Roberts wrote:
On 1/12/2011 1:45 PM, Don Clugston wrote:
---
import std.math;

void main()
{
      assert( rndtol(-3.0) == -3 );
}
---

This is the only failure in std.mathspecial.

Confirmed buggy in d1 as well.

The generated code:
_Dmain:
                push    RBP
                mov     RBP,RSP
                sub     RSP,010h
                fld     tbyte ptr FLAT:.rodata[00h][RIP]
                fistp   long64 ptr -8[RBP]
                mov     EAX,-8[RBP]
                cmp     RAX,0FFFFFFFDh
                je      L25
                mov     EDI,7
                call      _D3bug8__assertFiZv@PC32
L25:            xor     EAX,EAX
                leave
                ret

Comparing it with the 32 bit version, the tbyte ptr part is fine, but the mov
EAX is almost certainly wrong.

Try this change.. tested only with this repro case so far:

Index: backend/cg87.c
===================================================================
--- backend/cg87.c      (revision 880)
+++ backend/cg87.c      (working copy)
@@ -3063,7 +3063,11 @@
             genfltreg(c2,0x8B,findreglsw(retregs),0);
         }
         else
+        {
             c2 = genfltreg(c2,0x8B,reg,0);      // MOV reg,floatreg
+            if (tysize(tym) == 8 && I64)
+                code_orrex(c2, REX_W);
+        }
         c2 = cat(c2,fixresult(e,retregs,pretregs));

         return cat(c1,c2);

_______________________________________________
dmd-internals mailing list
[email protected]
http://lists.puremagic.com/mailman/listinfo/dmd-internals


_______________________________________________
dmd-internals mailing list
[email protected]
http://lists.puremagic.com/mailman/listinfo/dmd-internals

Reply via email to