[Bug optimization/10620] for(i=25000;i;i--) {} generates wrong assembly source in avr-gcc with -O2
gumo@lucifer.kgt.bme.hu
gcc-bugzilla@gcc.gnu.org
Fri May 23 08:37:00 GMT 2003
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=10620
------- Additional Comments From gumo@lucifer.kgt.bme.hu 2003-05-23 07:51 -------
Subject: Re: [Bug optimization/10620] for(i=25000;i;i--) {} generates wrong
assembly source in avr-gcc with -O2
Hi,
> I certainly don't know much about avr asm. With gcc 3.2.3 and 3.3 branch, I see the same code
> that you mention (.L10 etc.) generated. With mainline (20030520), I see the following:
>
> .L8:
> subi r18,lo8(-(-50))
> sbci r19,hi8(-(-50))
> brne .L8
>
> Is this assembly also faulty? Thanks,
Yes. The original C code is i--, so it should decrease the register pair
by 1:
subi r18,lo8(-(-1))
sbci r19,hi8(-(-1))
Thanks,
Gumo
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
More information about the Gcc-bugs
mailing list