[Issue 11740] [64-bit] Struct with constructor incorrectly passed on stack

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Dec 16 01:38:58 PST 2013


https://d.puremagic.com/issues/show_bug.cgi?id=11740



--- Comment #4 from Iain Buclaw <ibuclaw at ubuntu.com> 2013-12-16 01:38:55 PST ---
Exhibit A:
Constructors == non-POD in the frontend. This seems to be because of a
DMD-specific bug:

 * Note that D struct constructors can mean POD, since there is always default
 * construction with no ctor, but that interferes with OPstrpar which wants it
 * on the stack in memory, not in registers.

https://github.com/D-Programming-Language/dmd/blob/master/src/struct.c#L851


Exhibit B:
non-POD types are passed in memory according to toArgTypes:

https://github.com/D-Programming-Language/dmd/blob/master/src/argtypes.c#L286


Exhibit C:
core.stdc.stdarg handles this (condition at #L349 is false because of the
above) Though changing the behaviour should require no change to
core.stdc.stdarg:

https://github.com/D-Programming-Language/druntime/blob/master/src/core/stdc/stdarg.d#L443http://forum.dlang.org/post/513A33F5.6060205@digitalmars.com


Exhibit D:
<Walter> A non-POD cannot be in registers because its address gets taken for
constructors/destructors.

And he later asserts this in the thread.

http://forum.dlang.org/post/511FE6AB.60802@digitalmars.com


Exhibit E:
<Walter> If it lives in a register, then exception handling recovery won't work
on it.

http://forum.dlang.org/post/513A33F5.6060205@digitalmars.com



These considerations must be taken into account.

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


More information about the Digitalmars-d-bugs mailing list