> -----Original Message-----
> From: 
> [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED]
> org] On Behalf Of Anatoly Sokolov
> Sent: Monday, June 02, 2008 12:19 AM
> To: [email protected]
> Subject: [avr-gcc-list] BUG: GCC use don't saved registers in 
> ISR with -O3optimization
> 
> 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

Hi Anatoly,

Do you have a GCC bug report for this yet? I could not find one...

Eric


_______________________________________________
AVR-GCC-list mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/avr-gcc-list

Reply via email to