[dmd-internals] 64bit bad codegen from ulong pointers.
Don Clugston
dclugston at googlemail.com
Tue Jan 4 13:18:51 PST 2011
Aargh, it was an incorrect reduction. Here's an larger case which
fails with the latest DMD, Phobos, and druntime.
(Reducing test cases is a bit painful through a remote connection).
-------------
double nextUpw(double x) @trusted nothrow
{
ulong *ps = cast(ulong *)&x;
if ((*ps & 0x7FF0_0000_0000_0000) == 0x7FF0_0000_0000_0000) {
if (x == -x.infinity) return -x.max;
return x;
}
if (!(*ps & 0x8000_0000_0000_0000L)) {
assert(x>=0);
}
return x;
}
void main()
{
nextUpw(-double.min_normal*(1.0 - double.epsilon));
}
=========
On 3 January 2011 23:37, Walter Bright <walter at digitalmars.com> wrote:
> Works when I try it. Do you have the latest dmd?
>
> Don Clugston wrote:
>>
>> Reduced test case from std.math. *ps is 0x800F_FFFF_FFFF_FFFF, yet
>> the if() branch is not taken.
>> This one looks as though it might be the root cause of many failures.
>>
>> void check(double x)
>> {
>> ulong *ps = cast(ulong *)&x;
>> if (*ps & 0x8000_0000_0000_0000) {}
>> else assert(x>=0);
>> }
>>
>> void main()
>> {
>> check(-double.min_normal*double.epsilon);
>> }
>>
>>
>
> _______________________________________________
> 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