http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56637
--- Comment #6 from Dominique d'Humieres <dominiq at lps dot ens.fr> 2013-03-16 21:36:54 UTC --- > I don't mean to be argumentative, but I would like to ask: > Would an index out of bounds explain why single stepping over the statement > make it work, and would it explain that a higher level of optimization works? Absolutely: all the errors mentioned by Thomas give behaviors sensitive to the memory layout! However if you compile with -fcheck=bounds, out of bounds error(s) should be detected. Did you check that you pass the right arguments (position, type, kind, ...) to the procedures in the libraries you are using?