When in debug mode the compiler probably turns off some of the more advanced optimizations to make the debug view more sensible. If you code is not compliant to the C standard it may work at low optimization levels, but will then break when the optimizer makes assumptions about the code which should be true but are not. Either that or it is a compiler bug =PCan you post information about what actually goes wrong, and what the disassembly looks like for the relevant pieces of code from both version you built?Iso