[dmd-internals] 64 bit bug: rndtol fails.
Brad Roberts
braddr at puremagic.com
Tue Jan 18 01:44:55 PST 2011
On 1/18/2011 1:20 AM, 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.
>
> 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);
The unit tests all pass still -- not that there's likely terribly much that
exercises that particular builtin function. I've also confirmed that
std.mathspecial's unittests pass with this fix too. Once DMD's change is
checked in, it can be removed from the disabled list in phobos' posix.mak.
Thanks for the reduced test case. Have you done a similar analysis for
std.math's unit test failure?
Later,
Brad
More information about the dmd-internals
mailing list