Thread overview
[Issue 2385] New: spec says all structs are returned via hidden pointer on linux, but it uses registers
Oct 02, 2008
d-bugmail
Oct 21, 2008
d-bugmail
Nov 08, 2010
Walter Bright
Nov 08, 2010
Walter Bright
October 02, 2008
http://d.puremagic.com/issues/show_bug.cgi?id=2385

           Summary: spec says all structs are returned via hidden pointer on
                    linux, but it uses registers
           Product: D
           Version: 1.034
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Keywords: spec
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla@digitalmars.com
        ReportedBy: tomas@famolsen.dk


the following test compiled with dmd 1.034 on linux should return via a hidden pointer parameter, but is actually returned in registers:

struct S
{
    int x;
    int z;
    static S foo()
    {
        S s = {1,2};
        return s;
    }
}

becomes

_D4test1S3fooFZS4test1S:
                push    EBP
                mov     EBP,ESP
                sub     ESP,8
                mov     dword ptr -8[EBP],1
                mov     dword ptr -4[EBP],2
                mov     EDX,-4[EBP]
                mov     EAX,-8[EBP]
                leave
                ret


-- 

October 21, 2008
http://d.puremagic.com/issues/show_bug.cgi?id=2385


bugzilla@digitalmars.com changed:

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




------- Comment #1 from bugzilla@digitalmars.com  2008-10-20 22:20 -------
Fixed dmd 1.036 and 2.020


-- 

May 12, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2385


Tomas Lindquist Olsen <tomas@famolsen.dk> changed:

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




--- Comment #2 from Tomas Lindquist Olsen <tomas@famolsen.dk>  2009-05-12 12:30:04 PDT ---
the spec now says:

# For Windows, 1, 2 and 4 byte structs are returned in EAX.
# For Windows, 8 byte structs are returned in EDX,EAX, where EDX gets the most
significant half.
# For other struct sizes, the return value is stored through a hidden pointer
passed as an argument to the function.

I don't think just removing the info on linux is a satisfactory fix, the asm is still the same!

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 12, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2385


Tomas Lindquist Olsen <tomas@famolsen.dk> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Depends on|                            |2648




--- Comment #3 from Tomas Lindquist Olsen <tomas@famolsen.dk>  2009-05-12 12:33:23 PDT ---
Very much related to:

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

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
November 08, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=2385


Walter Bright <bugzilla@digitalmars.com> changed:

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


--- Comment #4 from Walter Bright <bugzilla@digitalmars.com> 2010-11-08 01:02:24 PST ---
http://www.dsource.org/projects/phobos/changeset/2132

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
November 08, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=2385


Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |clugdbug@yahoo.com.au

Bug 2385 depends on bug 2648, which changed state.

Bug 2648 Summary: Unnecessary struct ABI inconsistency http://d.puremagic.com/issues/show_bug.cgi?id=2648

           What    |Old Value                   |New Value
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |DUPLICATE

--- Comment #5 from Walter Bright <bugzilla@digitalmars.com> 2010-11-08 01:03:29 PST ---
*** Issue 2648 has been marked as a duplicate of this issue. ***

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------