Bug 2385 – spec says all structs are returned via hidden pointer on linux, but it uses registers

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D1 (retired)
Platform
x86
OS
Linux
Creation time
2008-10-02T05:22:00Z
Last change time
2014-03-01T00:36:26Z
Keywords
spec
Assigned to
bugzilla
Creator
tomas
Depends on
2648
Blocks
3105

Comments

Comment #0 by tomas — 2008-10-02T05:22:00Z
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
Comment #1 by bugzilla — 2008-10-20T22:20:25Z
Fixed dmd 1.036 and 2.020
Comment #2 by tomas — 2009-05-12T12:30:04Z
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!
Comment #3 by tomas — 2009-05-12T12:33:23Z
Comment #4 by bugzilla — 2010-11-08T01:02:24Z
Comment #5 by bugzilla — 2010-11-08T01:03:29Z
*** Issue 2648 has been marked as a duplicate of this issue. ***