This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

no Loop Invariant Motion?


I have a simple C code :

#include<stdio.h>
int *c;
int main ()
{
??????? int a=0, b;
??????? while (a < 100)
??????? {
??????????????????????? b = 10;
??????????????????????? a = a + 1;
??????? }
??????? c = &b;
??????? printf ("%d\n", *c);
??????? return 0;
}

I would basically expect the b = 10 statement to be moved out of the
while loop, as it is an invariant.
However, it does not seem to happen in the *.lim dump file.
I am using gcc 4.4.2 to compile, and the cmd line options are
install/bin/gcc -fdump-tree-all -O3 filename.c

Can anyone explain what went wrong?

--
With Regards,
Prashant SIngh Rawat
MTech, CSE, IIT Bombay


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]