------- Comment #17 from mikpe at it dot uu dot se 2010-05-29 14:47 ------- Created an attachment (id=20772) --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=20772&action=view) test case from copypage-xscale.c
This is distilled from the kernel's copypage-xscale.c file and illustrates the issue. With gcc-4.4 the __naked__ function foo() is called with the standard call sequence register assignment, so the asm() body of foo() works. With gcc-4.5 foo() is cloned and gets its second parameter `to' in r0 (not r1 as expected), and the body of foo() is modified to set up the actual first parameter (&fie[0]) in r1 (not r0 as expected). Obviously the asm() then breaks. Compiling with -fno-ipa-cp avoids this problem, as does adding __noclone__ and __noinline__ to foo()'s function definition. I don't immediately see how to enforce __noclone__ and __noinline__ in the ARM backend when it sees __naked__. Any ideas? -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44290