------- Additional Comments From danglin at gcc dot gnu dot org 2005-01-20 04:25 ------- I can reproduce this 3.3.3 and 3.4.3. However, 4.0.0 doesn't have the problem. While this problem may be target specific (ie., a big endian target with downward padding for structures), I don't believe this is actually a target specific problem.
The 3.4.3 code generated in main to call "foo" looks like this: stw %r2,-20(%r30) copy %r3,%r1 copy %r30,%r3 stwm %r1,128(%r30) stw %r3,-4(%r30) stw %r26,-36(%r3) stw %r25,-40(%r3) ldw 16(%r3),%r19 stw %r19,-54(%r30) ldh 20(%r3),%r19 sth %r19,-50(%r30) ldo 8(%r3),%r26 ldi 0,%r25 ldi 0,%r24 .CALL ARGW0=GR,ARGW1=GR,ARGW2=GR bl _ZN1A3fooEii12WrongPadding,%r2 nop The "stw %r19,-54(%r30)" insn is a misaligned store and causes the problem. I also can't duplicate the problem in C. In that case, half-word loads and stores are used for storing the struct to the stack for the call. Thus, I suspect that this actually is a C++ bug. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18956