http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50225
--- Comment #1 from Dominique d'Humieres <dominiq at lps dot ens.fr> 2011-08-29 13:49:48 UTC --- On x86_64-apple-darwin10 I don't need the option -fcheck=all to get the run-timr error. However the error goes away with any optimization above -O1 (at least all those I have tried;-). This is also true for the original code posted at http://gcc.gnu.org/ml/fortran/2011-08/msg00239.html which gives Two-dimensional walk: 1.0883 0.1832 1.0618 0.1794 0.9765 0.0804 0.9459 0.0489 0.8895 -0.0245 0.9696 -0.0471 0.9587 -0.0147 0.8620 0.0154 0.8912 -0.0200 0.9624 -0.0397 Three-dimensional walk: -0.5517 0.9285 0.1628 -0.6316 0.9795 0.1839 -0.5878 1.0590 0.2156 -0.6576 1.0815 0.3113 -0.5578 1.0328 0.3215 -0.5260 1.0436 0.4170 -0.4456 1.0752 0.4628 -0.4651 1.1609 0.3924 -0.4302 1.2149 0.3602 -0.5070 1.2377 0.4244 if compiled with -O1 or above. Note also that the executable obtained with -O1 run under valgrind without error. Apparently the "wrong part" is removed by some optimization starting at -O1.