------- Comment #15 from bergner at vnet dot ibm dot com 2005-11-04 17:38
-------
For completeness, here is a minimal test case that shows the problem we are
having:
[EMAIL PROTECTED]:~/olaf/PR24644-4> cat bar.c
register struct paca_struct * local_paca asm("r13");
struct paca_struct { volatile long state; };
extern void foo(void);
int migration_thread(void)
{
local_paca->state = 1;
foo();
local_paca->state = 0;
return 0;
}
[EMAIL PROTECTED]:~/olaf/PR24644-4> ~/gcc/dataflow-base/bin/gcc -m64 -O1 -S
bar.c
The code we get looks like:
.migration_thread:
mflr 0
std 29,-24(1)
std 0,16(1)
stdu 1,-144(1)
mr 29,13
li 0,1
std 0,0(13)
bl .foo
nop
li 0,0
std 0,0(29)
li 3,0
addi 1,1,144
ld 0,16(1)
mtlr 0
ld 29,-24(1)
blr
This looks like gcc thinks r13 will be trashed by the call to foo() so it
copies it to a non volatile register for use after the call. Strange that this
didn't happen before the patch found by Olaf.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24644