[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[avr-gcc-list] BUG: GCC use don't saved registers in ISR with -O3 optimi
From: |
Anatoly Sokolov |
Subject: |
[avr-gcc-list] BUG: GCC use don't saved registers in ISR with -O3 optimization |
Date: |
Mon, 2 Jun 2008 10:19:03 +0400 |
Hello.
Testcase:
#include <avr/io.h>
#include <avr/interrupt.h>
volatile unsigned char UART_RxChar;
volatile unsigned char UART_ReceivedChar;
SIGNAL(SIG_USART_RECV)
{
/* Indicate that the UART has received a character */
UART_ReceivedChar = 1;
/* Store received character */
UART_RxChar = UDR;
}
Request: use -frename-registers optimization, enabled on -O3.
Result code:
.global __vector_13
.type __vector_13, @function
__vector_13:
.LFB2:
.LM1:
push __zero_reg__
push r0
in r0,__SREG__
push r0
clr __zero_reg__
push r24
/* prologue: Signal */
/* frame size = 0 */
.LM2:
ldi r26,lo8(1)
sts UART_ReceivedChar,r26
.LM3:
lds r24,198
sts UART_RxChar,r24
/* epilogue start */
.LM4:
pop r24
pop r0
out __SREG__,r0
pop r0
pop __zero_reg__
reti
R26 register used in ISR but don't saved/restored.
Workaround: Don't use '-frename-registers' optimization. Disable
'frename-registers'
optimization with '-fno-rename-registers' switch when used -O3.
Bug fix: need define HARD_REGNO_RENAME_OK macro in config/avr.h
Anatoly.
- [avr-gcc-list] BUG: GCC use don't saved registers in ISR with -O3 optimization,
Anatoly Sokolov <=