On 5/3/08, Benj FitzPatrick <benjfitz@xxxxxxxxx> wrote: > I forgot to include > > return(integral); > > My question is why does the buggy code give the > correct answer with no optimizations, but an incorrect > answer with optimizations turned on? Because by chance, without optimisation, your "integral" variable happens to be stored (or a copy of its value happens to be left) in the same register or stack location as the default place for function call results. I would guess it's the first item on the stack while the function is alive and the first item after the top of the stack when it return. M