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

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

Re: [avr-gcc-list] GCC 3.0.2 unsigned int bug?


From: Dmitry
Subject: Re: [avr-gcc-list] GCC 3.0.2 unsigned int bug?
Date: Tue, 18 Dec 2001 11:10:19 +0300

The compiler does the right thing on the loop unrolling pass.
It does 32 iterations where it can reach the value of 1024.

try to recompile this file with d less than 1024 and d=1024+something.

have fun,
D.


On Mon, 17 Dec 2001 14:06:09 -0600
Chris Elmquist <address@hidden> wrote:

> 
> I'm new here... just playing around with avr-gcc 3.0.2 on
> Linux.
> 
> I'm having trouble understanding this:
> 
> void delay(void)
> {
>         unsigned int d;
> 
>         d = 0x1000;
>         while (d) d--;
> }
> 
> generates this code (using avr-objdump --disassemble):
> 
> 0000004a <delay>:
>   4a:   80 e0           ldi     r24, 0x00       ; 0
>   4c:   90 e1           ldi     r25, 0x10       ; 16
>   4e:   80 50           subi    r24, 0x00       ; 0
>   50:   94 40           sbci    r25, 0x04       ; 4
>   52:   e9 f7           brne    .-6             ; 0x4e
>   54:   08 95           ret
> 
> I can clearly see that the MSB goes in r25 and the LSB in r24
> but then why does it subtract 0x04 from the MSB each iteration?
> 
> Suspecting maybe a disassembler problem, the '94 40' opcode
> indeed would subtract 0x40 from the MSB wouldn't it?
> 
> Am I missing something obvious here or is this a bug?
> 
> Chris
> -- 
> Chris Elmquist      mailto:address@hidden     http://www.pobox.com/~chrise
> 
> _______________________________________________
> avr-gcc-list mailing list
> address@hidden
> http://avr.jpk.co.nz/mailman/listinfo/avr-gcc-list
> 


*********************************************************************
   ("`-''-/").___..--''"`-._     (\       Dimmy the Wild      UA1ACZ
    `6_ 6  )   `-.  (     ).`-.__.`)      Enterprise Information Sys 
    (_Y_.)'  ._   )  `._ `. ``-..-'       Nevsky prospekt,   20 / 44
  _..`--'_..-_/  /--'_.' ,'               Saint Petersburg,   Russia
 (il),-''  (li),'  ((!.-'                 +7 (812) 314-8860, 5585314
*********************************************************************



reply via email to

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