April 17, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=6758



--- Comment #10 from Don <clugdbug@yahoo.com.au> 2012-04-17 06:33:40 PDT ---
The problem is worse than I thought.

cod1.c, line 2450, cdfunc()

puts an array parameter into registers, instead of the stack, if there are
enough free registers.
Nothing that fits into a register ever has additional stack alignment. So
effectively, it is aligned as size_t.
ie, parameter[i].numalign = 0.

But, once the registers are full, it becomes treated as a ucent, and gets extra
stack alignment.
parameter[i].numalign = 8;

Then, in line 2528, if it was on the stack, the code to align the stack (SUB
RSP, numalign) is generated.
But, in 2564, this doesn't get happen for register parameters. Instead, the
registers are just saved without any padding.

So it is NOT sufficient to adjust stdc.stdarg, to treat delegates and d arrays as if their alignof was ucent.alignof. Rather, they should be treated as sizeof.alignof, unless there are no registers left, in which case it should be ucent.alignof.

Perhaps it would be enough to set cod1.c line 2452:

               // Parameter i goes on the stack
                parameters[i].reg = -1;         // -1 means no register
-                unsigned alignsize = el_alignsize(ep);
+                unsigned alignsize = ty64reg(ty) ? 0 : el_alignsize(ep);
                parameters[i].numalign = 0;
                if (alignsize > stackalign)

so that if it fits into a register, it is never aligned.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
April 18, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=6758



--- Comment #11 from github-bugzilla@puremagic.com 2012-04-18 00:08:06 PDT ---
Commit pushed to dmd-1.x at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/71c0d29d66c3fe946e1a714eef8098e6ad3dd373
fix Issue 6758 - std.c.stdarg problems with 8 or more integer arguments on
x86_64

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
April 18, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=6758



--- Comment #12 from github-bugzilla@puremagic.com 2012-04-18 00:08:21 PDT ---
Commit pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/6b5485754868204358b1160b1a9515953d0ed6bc
fix Issue 6758 - std.c.stdarg problems with 8 or more integer arguments on
x86_64

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
April 18, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=6758



--- Comment #13 from github-bugzilla@puremagic.com 2012-04-18 00:17:24 PDT ---
Commit pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/f87c43317a97b75c69639499a6445b82415739a3 add test case for Issue 6758

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
April 18, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=6758


Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bugzilla@digitalmars.com
         Resolution|                            |FIXED


-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
1 2
Next ›   Last »