As per Philippe Guillot's email:
"The "double" (64 bits floats) management runs but the
generated code is not correct. The stack is spared and
the stack pointer value is not correctly restored.
Although, the code runs properly due to the final
"unlk a6" instruction that clean up the stack, complex
expression may lead to a "stack overflow" and the error
would be difficult to diagnose."
Logged In: YES
user_id=583634
Further info from Philippe:
"For information, this is the code generated by
void foo(){
float x;
x=x*x;
}
is (disassembled with RsrcEdit):
0000 link a6,#-48 <-- a huge value regarding to the only 4
bytes local
0004 move.l -4(a6),-(a7) ; first, convert x into a double in -20
(a6) (first additionnal local)
0008 pea -20(a6)
000C moveq #11,d2
000E systrap
0012 addq.l #8,a7
0014 move.l -16(a6),-8(a6) ; transfert the first additionnal
local to a second one located at -12(a6)
001A move.l -20(a6),-12(a6)
0020 move.l -4(a6),-(a7) ; convert x into double in a third
additionnal local
0024 pea -36(a6)
0028 moveq #11,d2
002A systrap
002E addq.l #8,a7
0030 move.l -32(a6),-24(a6) ; transfert in a fourth
additionnal local
0036 move.l -36(a6),-28(a6)
003C move.l -24(a6),-(a7) ; compute x*x with the double
routine to a fifth additionnal local
0040 move.l -28(a6),-(a7)
0044 move.l -8(a6),-(a7)
0048 move.l -12(a6),-(a7)
004C pea -44(a6)
0050 moveq #52,d2
0052 systrap
0056 lea 20(a7),a7
005A move.l -40(a6),-(a7) ; convert the result into float in a
sixth additionnal local
005E move.l -44(a6),-(a7)
0062 moveq #12,d2
0064 systrap
0068 addq.l #8,a7
006A move.l d0,-48(a6)
006E move.l -48(a6),-4(a6) ; transfert the float to the final
destination.
0074 unlk a6
0076 rts
The code is correct, but may certainely be improved. The
direct use of the float manager function lead to a more
efficient code. (but more difficult for the programmer)."
Logged In: YES
user_id=574706
I second! Please go for a vote!