[Bug middle-end/42722] move_by_pieces() incorrectly pushes structures to stack
mikpe at it dot uu dot se
gcc-bugzilla@gcc.gnu.org
Tue Feb 9 08:58:00 GMT 2010
------- Comment #10 from mikpe at it dot uu dot se 2010-02-09 08:58 -------
(In reply to comment #9)
> Finally, the m32c port defines both PUSH_ARGS and HAVE_POST_INCREMENT, so it
> can be possible to reproduce the bug on this port.
> cat pr42722.c
struct test {
int a, b, c, d;
};
void func2(struct test copy);
void func1(struct test copy) {func2(copy);}
> m32c-unknown-elf-gcc -Os -S pr42722.c
> cat pr42722.s
.file "pr42722.c"
.text
.global _func1
.type _func1, @function
_func1:
enter #0
push.w 11[fb]
push.w 9[fb]
push.w 7[fb]
push.w 5[fb]
jsr.a _func2
add.w #8,sp
exitd
.size _func1, .-_func1
.ident "GCC: (GNU) 4.4.3"
which looks correct to me (not knowing m32c asm at all). With a larger struct
gcc generates a memcpy() call instead.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42722
More information about the Gcc-bugs
mailing list