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

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

[avr-gcc-list] avr-gcc bug ??


From: Torsten Hahn
Subject: [avr-gcc-list] avr-gcc bug ??
Date: Tue, 13 May 2003 15:58:56 +0200

Hi, i compiled the following code with

avr-gcc (GCC) 3.2 20020614 (experimental)

and with the option -Os (its a larger Project)

void ADC_SampleTest()
{
        register uint16_t count, i;
        register uint16_t *ram;         
        // init the adc
        ADC_Init();
        
        count = 300;
        ram = (uint16_t *)(data);
        
        ADC_Sample( count, ram );
        
        for( i=count; i==0; i--)
        {
                printData( i, ram[i] );
        }
        
        DisplayData();
}

i got this assembler Listing:

00000090 <ADC_SampleTest>:
  90:   0e 94 00 00     call    0x0
  94:   60 e0           ldi     r22, 0x00       ; 0
  96:   70 e0           ldi     r23, 0x00       ; 0
  98:   8c e2           ldi     r24, 0x2C       ; 44
  9a:   91 e0           ldi     r25, 0x01       ; 1
  9c:   0e 94 00 00     call    0x0
  a0:   0e 94 00 00     call    0x0
  a4:   08 95           ret


Where is the for(...) loop ? If i try the same with an upcounting loop like:

        for( i=0; i<count; i++)
        {
                printData( i, ram[i] );
        }

i get the right thing. Do i miss something or is this really an compiler / optimisation bug ??

cu,
Torsten.


--
Dipl. Nat. Torsten Hahn
Institut für Experimentelle Physik / TU Bergakademie Freiberg
mail: address@hidden
Tel.: +49 (0) 3731 392670


reply via email to

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