[dmd-internals] 64 bit bug: rndtol fails.
Brad Roberts
braddr at puremagic.com
Tue Jan 18 20:53:44 PST 2011
Another one down.. 18 phobos tests left. 22 dmd tests left (was 29 and 33 at
last report on Jan 6).
On 1/18/2011 8:39 PM, Walter Bright wrote:
> 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 at 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
>> dmd-internals at puremagic.com
>> http://lists.puremagic.com/mailman/listinfo/dmd-internals
>>
>>
>>
> _______________________________________________
> dmd-internals mailing list
> dmd-internals at puremagic.com
> http://lists.puremagic.com/mailman/listinfo/dmd-internals
More information about the dmd-internals
mailing list