Bug 993 – incorrect ABI documentation for float parameters

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P3
Component
dmd
Product
D
Version
D1 (retired)
Platform
x86
OS
Linux
Creation time
2007-02-21T19:33:00Z
Last change time
2014-02-16T15:23:06Z
Assigned to
bugzilla
Creator
thomas-dloop

Comments

Comment #0 by thomas-dloop — 2007-02-21T19:33:57Z
If the last function parameter is a float it is passed via the stack and not via EAX. # The last parameter is passed in EAX rather than being pushed on # the stack if the following conditions are met: # # * It fits in EAX. # * It is not a 3 byte struct. missing condition: # * not a float/ifloat # void test(float f){ # assert(16.5 == f); # } # # void main(){ # float f = 16.5; # int i = *cast(int*)&f; # version(bug){ # asm{ # mov EAX, i; # call test; # } # }else{ # asm{ # push i; # call test; # pop i; # } # } # } dmd test.d && ./test && echo OK > OK dmd -version=bug test.d && ./test && echo OK > Error: AssertError Failure bug.d(2)
Comment #1 by fvbommel — 2007-02-22T03:05:21Z
Nitpick: that "pop i" after the call in the else clause shouldn't be there. D functions pop their own arguments, except in case of varargs.
Comment #2 by bugzilla — 2007-03-19T17:37:24Z
Fixed DMD 1.009