avr-gcc-list
[Top][All Lists]
Advanced

[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
www.barello.net/avrx/GCC-AvrX-2.5/gcc-avrx-2.5a.zip
------------
    while(1)
    {
        outp(~led, PORTB);
        pMsg = (pMyMessage)AvrXWaitMessage(&MyQueue);
        if (pMsg == &SwitchMsg)
        {
            led ^= ~(pMsg->data);
            AvrXAckMessage(&pMsg->mcb);
        }
        else if ((pTimerMessageBlock)pMsg == &Timer)
        {
            asm("rol %0\n"\
                "\tbrcc .+2\n"\
                "\tinc %0\n"  ::"r" (led));
            AvrXStartTimerMessage(&Timer, 150, &MyQueue);
        }
        else
        {
            AvrXHalt();
        }
    }

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

 .stabn 68,0,98,.LM17-flasher
.LM17:
/* #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
.LM18:
.L30:
 lds r20,SwitchMsg+4
 com r20
 eor r29,r20
 .stabn 68,0,91,.LM19-flasher
.LM19:
 mov r25,r19
 mov r24,r18
 rcall AvrXAckMessage
 rjmp .L31
.L27:
 .stabn 68,0,102,.LM20-flasher
.LM20:
 rcall AvrXHalt
 rjmp .L19






reply via email to

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