Topic: Odd optimizer bug
I stumbled across an odd optimizer bug. I just though that I'd flag it here.
I was updating "Calpak" a collection of Calendar routines by John Burkardt
and I found that it generated a lot on nonsense at optimization level -O3
but worked perfectly with no optimizations. After a lot to sleuthing, I
tracked it down to this line: CALL Y_ASTRONOMICAL_TO_COMMON(Y , Y)
the left "Y" is the input and the right "Y" is the output. I am not sure exactly what
the optimizer was doing, but at -O3, it was returning just random junk.
doing this, fixed it;
temp=y
CALL Y_ASTRONOMICAL_TO_COMMON(Y , temp)
y=temp
So, if you are getting inexplicable results in your code, check that you don't have the same error.