Simon Marlow simonmar@microsoft.com
Thu, 18 Apr 2002 13:17:00 +0100

> In my program I observe that, with -O2 flag turned on,=20
> 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?