December 19, 2010 Optimiser bug ? | ||||
|---|---|---|---|---|
| ||||
Attachments: |
Here is a small program compiled with:
Digital Mars C/C++ Compiler Version 8.52.5n
I think there is a bug introduced by the optimiser.
Am I right ?
extern unsigned long D2UL(double);
unsigned long d2ul()
{
union
{ double d;
struct { unsigned long a,b; } S;
} U;
U.S.a = _EDX;
U.S.b = _EAX;
return D2UL(U.d);
}
#pragma alias("__DBLULNG@","_d2ul")
void main()
{
double d;
unsigned long ul;
d=(double)-1;
ul=d;
}
/*
* compiled with: dmc -o -c -cod u5 (optimised)
*/
_d2ul:
sub ESP,01Ch
mov 4[ESP],EDX
mov 8[ESP],EAX
// pushing the same piece 2 times ?
push dword ptr 8[ESP]
push dword ptr 8[ESP]
call near ptr _D2UL
add ESP,024h
ret
/*
* compiled with: dmc -c -cod u5 (no optimisation)
*/
_d2ul:
enter 8,0
mov -8[EBP],EDX
mov -4[EBP],EAX
// pushing 2 pieces
push dword ptr -4[EBP]
push dword ptr -8[EBP]
call near ptr _D2UL
add ESP,8
leave
ret
| |||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply