This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/33970] Missed optimization using unsigned char loop variable
- From: "wvangulik at xs4all dot nl" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 6 Nov 2007 21:01:48 -0000
- Subject: [Bug middle-end/33970] Missed optimization using unsigned char loop variable
- References: <bug-33970-15294@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #11 from wvangulik at xs4all dot nl 2007-11-06 21:01 -------
I just realised I did not tried hard enough to find the smallest case:
===========================================
volatile unsigned char bar;
void foo(void) {
unsigned char x;
for(x=0;x<128; x++) {
//bar = x+1;
bar = x;
}
}
Looks like using the loop counter inside the loop causes the problem. Because
when not using x, but just e.g. calling a function is also gives the smallest
loop.
Looking at the RTL output of test.c.00.expand. it allready is a QI vs HI
there... so it's going wrong some where inside gcc I really have no knowledge
off...
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33970