[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[avr-gcc-list] Hmmm, buggy code generation in 2.97

From: Larry Barello
Subject: [avr-gcc-list] Hmmm, buggy code generation in 2.97
Date: Thu Feb 1 06:15:04 2001

The "else if" and "else" clauses return to the middle of the
"outp(~led, PORTB); statement rather than the "while(1)"
ie. jump to L19 vs L31

Is this a known code generation bug?

compiler: Gunnar's ming32 distribution
Compiler flags: -g -O3 -Wall
File: MessageTimers.c
        outp(~led, PORTB);
        pMsg = (pMyMessage)AvrXWaitMessage(&MyQueue);
        if (pMsg == &SwitchMsg)
            led ^= ~(pMsg->data);
        else if ((pTimerMessageBlock)pMsg == &Timer)
            asm("rol %0\n"\
                "\tbrcc .+2\n"\
                "\tinc %0\n"  ::"r" (led));
            AvrXStartTimerMessage(&Timer, 150, &MyQueue);

-------------- Produces This ----------------
 mov r28,r29
 com r28
 .stabn 68,0,86,.LM12-flasher
/* #APP */
 out 24, r28
 .stabn 68,0,87,.LM13-flasher
/* #NOAPP */
 ldi r24,lo8(MyQueue)
 ldi r25,hi8(MyQueue)
 rcall AvrXWaitMessage
 mov r18,r24
 mov r19,r25
 .stabn 68,0,88,.LM14-flasher
 ldi r24,hi8(SwitchMsg)
 cpi r18,lo8(SwitchMsg)
 cpc r19,r24
 breq .L30
 .stabn 68,0,93,.LM15-flasher
 subi r18,lo8(Timer)
 sbci r19,hi8(Timer)
 brne .L27
 .stabn 68,0,95,.LM16-flasher
/* #APP */
 rol r29
 brcc .+2
 inc r29

 .stabn 68,0,98,.LM17-flasher
/* #NOAPP */
 ldi r20,lo8(MyQueue)
 ldi r21,hi8(MyQueue)
 ldi r22,lo8(150)
 ldi r23,hi8(150)
 ldi r24,lo8(Timer)
 ldi r25,hi8(Timer)
 rcall AvrXStartTimerMessage
 rjmp .L19
 .stabn 68,0,90,.LM18-flasher
 lds r20,SwitchMsg+4
 com r20
 eor r29,r20
 .stabn 68,0,91,.LM19-flasher
 mov r25,r19
 mov r24,r18
 rcall AvrXAckMessage
 rjmp .L31
 .stabn 68,0,102,.LM20-flasher
 rcall AvrXHalt
 rjmp .L19

reply via email to

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