993 – incorrect ABI documentation for float parameters

D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 993 - incorrect ABI documentation for float parameters
Summary: incorrect ABI documentation for float parameters
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D1 (retired)
Hardware: x86 Linux
: P3 normal
Assignee: Walter Bright
URL: http://www.digitalmars.com/d/abi.html
Keywords:
Depends on:
Blocks:
Reported: 2007年02月21日 19:33 UTC by Thomas Kühne
Modified: 2014年02月16日 15:23 UTC (History)
0 users

See Also:


Attachments
Add an attachment (proposed patch, testcase, etc.)

Note You need to log in before you can comment on or make changes to this issue.
Description Thomas Kühne 2007年02月21日 19:33:57 UTC
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 Frits van Bommel 2007年02月22日 03:05:21 UTC
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 Walter Bright 2007年03月19日 17:37:24 UTC
Fixed DMD 1.009


AltStyle によって変換されたページ (->オリジナル) /