In developing a 32 bit Windows command line program we recently encountered a situation where the debug version works as expected while the release version shows odd behavior in its computations that it should not. Now, this was not an uncommon problem 20+ years ago. For the release version, compiler optimization gets turned on and compiler optimization even now is not certain to work for all cases. So, in the past if we encountered this problem we would turn off the compiler optimizations - perhaps selectively if speed or space considerations were really important. This time we turned off all optimizations and the problem remained! The only difference between debug and release versions amounts to a series of compiler and loader settings. We went back and altered the release setting to match the debug settings as best we could and the problem remains! That We have never seen before.
This has all been on the VC6 platform, which we generally have been using for 32 bit Windows. That is right Microsoft Visual C++ 6.0. Our preference for VC6 is that we were beta tester for Microsoft on all versions of their C/C++ package up through VC6 and had been very active in the debugging of the optimizers. But since we've had no real problems with VC8 we tried that. In this case we just had VC8 convert the project we had been using. To our amazement I found that VC8 shows exactly the same problem. The debug version works and the release version does not. We may try creating the thing from scratch in VC8 and see if that makes a difference, but we rather suspect that it will not. At this point we do not understand this at all. It has to be a compiler switch setting somewhere that we are missing. Or does it?
What else can cause a difference between a release and a debug build?