www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 993] New: incorrect ABI documentation for float parameters

reply d-bugmail puremagic.com writes:
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 digitalmars.com
        ReportedBy: thomas-dloop 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)

--
Feb 21 2007
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=993





------- Comment #1 from fvbommel wxs.nl  2007-02-22 03:05 -------
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.


-- 
Feb 22 2007
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=993


bugzilla digitalmars.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED




------- Comment #2 from bugzilla digitalmars.com  2007-03-19 17:37 -------
Fixed DMD 1.009


-- 
Mar 19 2007