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

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

Re: [avr-gcc-list] Extremly confusing behaviour... (Suspect compiler?, o


From: Denis Chertykov
Subject: Re: [avr-gcc-list] Extremly confusing behaviour... (Suspect compiler?, optimization error?)
Date: 14 May 2003 23:23:32 +0400
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2

Mike Panetta <address@hidden> writes:

> I have tried -O3, and -Os both of which show the problem.  I have also
> tried -O0 which does not have the problem.
> 
> I can provide asm listings, should I post them to the list as
> attachments?  What optimization levels would you want to see?
> 
> I can just cut and paste the listing snippet of the do {} while(); loop
> if thats all you need.
> 
> Mike
> 
> PS I revise my comment about assigning any variable equal to retval.  It
> did not actually fix the problem.  It was something else.  However,
> casting the variable to an int8_t in the while (retval != 2) bit does
> fix the problem.

Hi Mike Panetta.

I have readed the thread and I want to help you because IMHO this bug
seems as compiler bug.

I need the following things:

1. Version of your compiler (output of avr-gcc -v);
2. Please build a synthetic test. ie test which isn't use any
   hardware;
3. Please find which changes in your test make it work right.
   ie: adding 'int8_t' before 'retval';
4. Send me a preprocessed source of your failed test and right working
   one.

After that I will fix the bug.

Denis.
PS: Thanks for bug reporting.
PPS: I have examined your report and founded that this fragment already
has a bug

     208:       02 e0           ldi     r16, 0x02       ; 2
     20a:       10 e0           ldi     r17, 0x00       ; 0
     20c:       20 e0           ldi     r18, 0x00       ; 0
     20e:       30 e0           ldi     r19, 0x00       ; 0
---------------------------------------^^^^^^^^^^ attention !
     210:       a6 01           movw    r20, r12
     212:       60 e0           ldi     r22, 0x00       ; 0
     214:       81 e0           ldi     r24, 0x01       ; 1
     216:       0e 94 9c 04     call    0x938
--------------------------------^^^^^^^^^^^^^  r18:r19 can be clobbered
                        PORTA &= ~(_BV(PA1));
     21a:       d9 98           cbi     0x1b, 1 ; 27
                        PORTB = retval;
     21c:       68 bb           out     0x18, r22       ; 24
                } while (retval != 2);
     21e:       60 17           cp      r22, r16
     220:       71 07           cpc     r23, r17
     222:       82 07           cpc     r24, r18
     224:       93 07           cpc     r25, r19
----------------------------------------     ^ seems as GCC bug
     226:       71 f6           brne    .-100           ; 0x1c4



reply via email to

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