[Issue 993] New: incorrect ABI documentation for float parameters

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Feb 21 17:34:09 PST 2007


http://d.puremagic.com/issues/show_bug.cgi?id=993

           Summary: incorrect ABI documentation for float parameters
           Product: D
           Version: 1.005
          Platform: PC
               URL: http://www.digitalmars.com/d/abi.html
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P3
         Component: DMD
        AssignedTo: bugzilla at digitalmars.com
        ReportedBy: thomas-dloop at kuehne.cn


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)


-- 



More information about the Digitalmars-d-bugs mailing list