attribute pure and gcse
Dara Hazeghi
dhazeghi@yahoo.com
Sat Apr 3 03:17:00 GMT 2004
Hello,
according to the gcc 3.3 manual, functions marked pure
should be candidates for common subexpression
elimination.
In the following case (which seems a good candidate),
the second call to square is not eliminated by gcse
(leastaways not with 3.3 on ppc). Is this expected, or
should cse be doing better here?
int square(int a) __attribute__ ((pure));
int square(int a)
{
int j=0;
while(j!=a)
{
a = j*a;
j++;
}
return a;
}
int main()
{
return square(2) * square(2);
}
Thanks,
Dara
__________________________________
Do you Yahoo!?
Yahoo! Small Business $15K Web Design Giveaway
http://promotions.yahoo.com/design_giveaway/
More information about the Gcc-help
mailing list