[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


#include <avr/io.h>
#include <avr/interrupt.h>

volatile unsigned char   UART_RxChar;
volatile unsigned char   UART_ReceivedChar;

    /* 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
 push __zero_reg__
 push r0
 in r0,__SREG__
 push r0
 clr __zero_reg__
 push r24
/* prologue: Signal */
/* frame size = 0 */
 ldi r26,lo8(1)
 sts UART_ReceivedChar,r26
 lds r24,198
 sts UART_RxChar,r24
/* epilogue start */
 pop r24
 pop r0
 out __SREG__,r0
 pop r0
 pop __zero_reg__

R26 register used in ISR but don't saved/restored.

Workaround: Don't use '-frename-registers' optimization.  Disable 
optimization with '-fno-rename-registers' switch when used -O3.

Bug fix: need define HARD_REGNO_RENAME_OK macro in config/avr.h


reply via email to

[Prev in Thread] Current Thread [Next in Thread]