Closed dinuxbg closed 5 years ago
Issue is also reproduced for x86. Reduced test case:
extern void abort (void);
int
test1 (void)
{
int res;
#ifdef __PRU__
asm volatile(
"ldi %[res], 101 \n\t"
"ldi32 sp, 0xaa55aa55 \n\t"
: [res] "=r" (res)
:
: "sp");
#else
asm volatile(
"movl $101, %[res] \n\t"
"movq $0xaa55aa55, %%rsp \n\t"
"movq $0xaa55aa55, %%rbp \n\t"
: [res] "=r" (res)
:
: "%rsp", "%rbp");
#endif
return res;
}
int
main (int argc, char** argv)
{
if (test1 () != 101)
abort();
return 0;
}
r2 (stack pointer) is special and the clobber is not honored by the compiler.