[Bug target/50289] New: [avr]: call-prologues saveing/restoring global register variables
gjl at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Sun Sep 4 21:52:00 GMT 2011
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50289
Bug #: 50289
Summary: [avr]: call-prologues saveing/restoring global
register variables
Classification: Unclassified
Product: gcc
Version: 4.6.1
Status: UNCONFIRMED
Keywords: wrong-code
Severity: normal
Priority: P3
Component: target
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: gjl@gcc.gnu.org
CC: eric.weddington@atmel.com
Target: avr
void bar (long long, long long, void*);
register char x asm ("7");
void foo (char a)
{
asm volatile ("":::"6");
bar (0, 0, &a);
}
This small program, compiles with
avr-gcc-4.6.1 -mcall-prologues -S -Os -mmcu=atmega8
to
foo:
ldi r26,lo8(1)
ldi r27,hi8(1)
ldi r30,lo8(gs(1f))
ldi r31,hi8(gs(1f))
jmp __prologue_saves__+((18 - 13) * 2)
1:
This means that __prologue_saves__ from libgcc saves R7 (i.e. R6..R17 and Y)
even though R7 is a global register variable and must not saved/restored by
function prologue/epilogue.
The function to fix is avr.c:sequent_regs_live()
More information about the Gcc-bugs
mailing list