public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/36424]  New: avr-gcc use don't saved registers in ISR with -O3 ('-frename-registers' ) optimization
@ 2008-06-02 17:56 aesok at gcc dot gnu dot org
  2008-06-02 18:06 ` [Bug target/36424] " aesok at gcc dot gnu dot org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: aesok at gcc dot gnu dot org @ 2008-06-02 17:56 UTC (permalink / raw)
  To: gcc-bugs

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.

To fix bug, need define HARD_REGNO_RENAME_OK macro in config/avr.h

Anatoly.


-- 
           Summary: avr-gcc use don't saved registers in ISR with -O3 ('-
                    frename-registers' ) optimization
           Product: gcc
           Version: 4.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: aesok at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36424


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2008-06-15 21:37 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-06-02 17:56 [Bug target/36424] New: avr-gcc use don't saved registers in ISR with -O3 ('-frename-registers' ) optimization aesok at gcc dot gnu dot org
2008-06-02 18:06 ` [Bug target/36424] " aesok at gcc dot gnu dot org
2008-06-04 22:56 ` eric dot weddington at atmel dot com
2008-06-08 16:09 ` aesok at gcc dot gnu dot org
2008-06-08 17:33 ` eric dot weddington at atmel dot com
2008-06-15 21:33 ` aesok at gcc dot gnu dot org
2008-06-15 21:37 ` aesok at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).