--- Comment #10 from Don <> 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

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:
------- You are receiving this mail because: -------

Reply via email to