------- Comment #4 from xavier dot guerin at imag dot fr 2010-02-07 12:32 ------- I checked GCC 4.4.2 and the issue still exists. It's extremely easy to check, and I actually pinned the issue. I don't mind helping more (and I guess I'll have to do it by myself anyway), but I'm completely ignorant concerning compilation stuff.
Basically, the issue is as follows. Let's say we have this situation (note that he behavior of function() is irrelevant) compiled for a mips32 architecture : int function (int n, ...) { } int main (void) { int32_t i32; int64_t i64_0, i64_1; function (3, i64_0, i32, i64_1); return 0; } ###### Caller behavior ###### In that case, main prepare the va_list. Right before calling function(), the stack looks like this: SP-40 [ X | X | X | X | n | X | upper (i64_1) | lower (i64_1) | X | RA ] SP whereas upper (i64_0) and lower (i64_0) are stored in registers a2 and a3. Please note that GCC inserts a bubble between 'n' and 'upper(i64_1)'. At first, I supposed this was for double-word alignment purpose, but in my case the address of 'upper (i64_1)' is not double-word aligned. ###### Callee behavior ###### Anyhow, the callee is waiting for the following stack pattern when mashalling the varargs: SP-40 [ X | X | X | X | n | upper (i64_1) | lower (i64_1) | X | X | RA ] SP which is the same configuration but without the bubble. As see it, the callee code must be correct since it refers to the algorithm described in function mips_gimplify_va_arg_expr(), line 5235 of the mips.c files, while the caller code wrongfully inserts a bubble to correct a padding problem that does not exit. I think this should shed some lights on the issue I'm encountering. Maybe somehow could tell me where I can found the va_list preparation code in the mips.c file. Thanks in advance for your help, Xavier -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39640