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

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

Re: [avr-gcc-list] avr-gcc bug (Win)


From: Denis Chertykov
Subject: Re: [avr-gcc-list] avr-gcc bug (Win)
Date: 28 Feb 2001 00:25:06 +0300

"Peter Bosscha" <address@hidden> writes:

> Content-type: text/plain ; charset = US-ASCII
> 
> Hi,
> 
> Found a bug in branch logic together with the BRGE instruction. 
> I'm using avr-libc-20010211 and -O2 and -Os give the same (erroneous) result.
> Tried to simplify this as much as possible so the code is a joke.
> 
> Have a look at the following:
> 
> unsigned char mycall(unsigned char parm)
> {
>  return 0x80;
> }
> 
> int main(void)
> {
> unsigned char i,a,b;
> 
>  a=mycall(0);
>  b=mycall(1);
>  do {
>   if (a) {
>    i = mycall(0);
>    if (i & 0x80) {
>     mycall(1);
>    } else {
>     if (b) {
>      mycall(2);
>     }
>    }
>   }
>  } while(1);
>  return 1;
> }
>
> In this example the jump at if (i & 0x80) goes the wrong way.

Point me to a wrong place in generated code.
My avr-gcc (CVS version) generates:


.global main
        .type   main,@function
main:
/* prologue: frame size=0 */
        ldi r28,lo8(__stack - 0)
        ldi r29,hi8(__stack - 0)
        out __SP_H__,r29
        out __SP_L__,r28
/* prologue end (size=4) */
        ldi r24,lo8(0)
        rcall mycall
        mov r29,r24
        ldi r24,lo8(1)
        rcall mycall
        mov r28,r24
.L11:
        tst r29
        breq .L11
        ldi r24,lo8(0)
        rcall mycall
        tst r24
        brlt .L12
        tst r28
        brne .L13
        rjmp .L11
.L12:
        ldi r24,lo8(1)
        rcall mycall
        rjmp .L11
.L13:
        ldi r24,lo8(2)
        rcall mycall
        rjmp .L11
/* epilogue: frame size=0 */
__stop_progIi__:
        rjmp __stop_progIi__
/* epilogue end (size=1) */
/* function main size 27 (22) */

> So ... 2 questions:
> 
> - is everyone else getting this too ?

Few weeks ago I have corrected such bug in GCC CVS.
I can't understand why I read bug reports about it.

> - if so, where to report this ?

This mailing list si a right place.




reply via email to

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