Re: Ancient bug in demo\callmach.ex
- Posted by jimcbrown (admin) Jan 26, 2010
- 854 views
Thanks for finding and reporting this.
This is fixed in svn:3059
petelomax said...
Although it works, that is probably by chance or an enter/leave thing. First, look at the (correct) definition:
multiply_code = { -- int argument is at stack offset +4, double is at +8 #DB, #44, #24, #04, -- fild dword ptr +4[esp] #DC, #4C, #24, #08, -- fmul qword ptr +8[esp] #C2, #0C * (platform()=WIN32), #00 -- ret C -- pop 12 (or 8) bytes -- off the stack }
Except for the misleading "(or 8)" that is fine. Now look at the earlier:
add_code = { -- first int argument is at stack offset +4, 2nd int is at +8 #8B, #44, #24, #04, -- mov eax, +4[esp] #03, #44, #24, #08, -- add eax, +8[esp] #C2, #00, #08 * platform() = WIN32 -- ret 8 -- pop 8 bytes off the stack }
Clearly, #08*platform()=WIN32 is always going to be 0 (false), unless the constant WIN32 changes or platform() returns 0.25. Secondly, were it doing what it looks like it should, then in decimal that would be a ret 2048.
No biggie, but wrong is wrong.
Regards, Pete