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]

attribute pure and gcse


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/


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