--- Eljay Love-Jensen <eljay@xxxxxxxxx> wrote: Hello, > > What is "int square(int)" supposed to do? Nothing actually :-) I just wanted an example of a "pure" function which should in theory be CSEable (from my understanding). > > If a is anything other than zero, a will be set to > zero by the "a = 0 * a;" > (when j := 0). And will remain zero for quite some > time thereafter. That's definitely true. My bad... > > Second, you may want to make square inline, so that > it can be CSE'd. Doesn't seem to help (added attribute always_inline)... But my understanding is that a pure function should have no "side-effects" thus two calls to it with the same arguments should be able to be eliminated in favor of a single call. This is what I need, and what I thought the manual was implying. Perhaps I'm reading it wrong though...? Dara P.S. Here's the (fixed) source in question: static int square(int a) __attribute__ ((pure)); static int square(int a) { int j=1, k=1; while(j!=a) { k = j*k; j++; } return k; } int main() { return square(100) * square(100); } __________________________________ Do you Yahoo!? Yahoo! Small Business $15K Web Design Giveaway http://promotions.yahoo.com/design_giveaway/