
18 Apr
2002
18 Apr
'02
8:17 a.m.
In my program I observe that, with -O2 flag turned on, Program 1 behaves like Program 2. And without O2, their outputs are different.
Is it the desirable behaviour? For my program, I did not expect the optimizer to do this transformation.
-O2 should not change the behaviour of the program, except where the behaviour is dependent on external factors (eg. I/O) or when the program uses unsafePerformIO. If that's not the case, could you send us the code so we can take a look? Cheers, Simon