Trying to solve DISUBSTR, I am getting 'wrong answer'. After some helpful clues I grabbed gcc-4.0.0 (I have gcc-4.1.2 installed as my default compiler), and have now determined that my code succeeds with gcc-4.0.0 with -O0, but fails with -O1.
Given that I seem to be hitting an optimisation bug in gcc, is there any way to specify that my code should be compiled without optimisation? Or do I have to find what the optimisation bug is and develop a specific workaround for it?
This is already rather frustrating: I've spent a lot of hours to get to this point, and I feel this is rather a distraction from the intention of the SPOJ site as a whole and of the DISUBSTR problem in particular - particularly since the same optimisation bug doesn't exist in the (slightly) more recent version of gcc that I have installed by default.
Hugo van der Sanden