[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-gcc-list] avr-gcc bug
From: |
Klaus Rotter |
Subject: |
Re: [avr-gcc-list] avr-gcc bug |
Date: |
Sun, 22 Apr 2001 11:56:33 +0200 |
User-agent: |
Mutt/1.2.5i |
On Sat, Apr 21, 2001 at 12:41:10PM -0300, Francisco T. A. Silva wrote:
> int main(void)
> {
> unsigned int i;
> for(i = 31533; i > 0; i--);
> }
I can verify this with an older version of avr-gcc
(gcc version 2.97 20010108 (experimental)). A much older version of avr-gcc
(2.95.2) behaves like you expected. If you want dead loops (e.g. for delay
lines), a possible solution may be to use volatile variables:
int main(void)
{
volatile unsigned int i;
for(i = 31533; i > 0; i--);
}
> avr-gcc-list mailing list
Then you get what you expect (even with -O3):
avr-gcc -O3 -S t.c
[...]
ldi r24,lo8(31533)
ldi r25,hi8(31533)
std Y+1,r24
std Y+2,r25
.L5:
sbiw r24,3
brne .L5
[...]
--
Klaus Rotter * address@hidden