Bug 13956 – 64 bit C ABI not followed for passing empty structs

Status
RESOLVED
Resolution
FIXED
Severity
major
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2015-01-08T16:52:00Z
Last change time
2015-02-18T03:42:13Z
Keywords
pull, wrong-code
Assigned to
yebblies
Creator
yebblies

Comments

Comment #0 by yebblies — 2015-01-08T16:52:58Z
Empty structs are allocated a register by dmd, screwing up any subsequent arguments. ============================================================ #include <stdarg.h> struct S0 { }; void checkValues(S0 arg0, int arg1, int arg2, int arg3, int arg4, int arg5, int arg6); void cppvararg(S0 arg0, int arg1, int arg2, int arg3, int arg4, int arg5, int arg6) { checkValues(arg0, arg1, arg2, arg3, arg4, arg5, arg6); } ============================================================ import core.stdc.stdarg; struct S0 { } extern(C++) void cppvararg(S0 arg0, int arg1, int arg2, int arg3, int arg4, int arg5, int arg6); extern(C++) void checkValues(S0 arg0, int arg1, int arg2, int arg3, int arg4, int arg5, int arg6) { assert(arg0 == S0()); assert(arg1 == 1); assert(arg2 == 2); assert(arg3 == 3); assert(arg4 == 4); assert(arg5 == 5); assert(arg6 == 6); } void main() { cppvararg(S0(), 1, 2, 3, 4, 5, 6); }
Comment #1 by yebblies — 2015-01-08T17:12:27Z
Comment #2 by github-bugzilla — 2015-01-11T04:38:18Z
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/de8bbd38f9b87de55ec39cbd38ab6ea0b34d579e Fix Issue 13956 - 64 bit C ABI not followed for passing empty structs Empty structs should never be allocated a register https://github.com/D-Programming-Language/dmd/commit/6340c23d1ce5d643d3e2392e51d93fa02ecea07a Merge pull request #4266 from yebblies/issue13956 Issue 13956 - 64 bit C ABI not followed for passing empty structs
Comment #3 by github-bugzilla — 2015-02-18T03:42:13Z