http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53732
--- Comment #3 from Tobias Burnus <burnus at gcc dot gnu.org> 2012-06-20 17:19:39 UTC --- Looking a bit deeper at the issue, the conditional code makes sense, but it does not make sense that "subscript" is true. The code seems to get set via an (earlier) call to gfc_add_loop_ss_code which calls for expr == "arr": case GFC_SS_SECTION: /* Add the expressions for scalar and vector subscripts. */ for (n = 0; n < GFC_MAX_DIMENSIONS; n++) if (info->subscript[n]) { gfc_add_loop_ss_code (loop, info->subscript[n], true, where); That call properly setups everything for a GFC_SS_SCALAR, where the argument is an integer(8) constant of value 1. I assume that part is okay. It then jumps to the end of the function which contains: if (!skip_nested) for (nested_loop = loop->nested; nested_loop; nested_loop = nested_loop->next) gfc_add_loop_ss_code (nested_loop, nested_loop->ss, subscript, where); That's the call which goes wrong as ss->info->expr is the 0.0d0 while the "subcript == true" is passed on, which causes the problem ... The two quoted code snippets have been added by Mikael in Rev. 180898 (2011-11-03), http://gcc.gnu.org/viewcvs?view=revision&revision=180898 * trans-array.c (gfc_add_loop_ss_code): Skip non-nestedmost ss. Call recursively gfc_add_loop_ss_code for all the nested loops. (gfc_conv_ss_startstride): Only get the descriptor for the outermost ss. Call recursively gfc_conv_ss_startstride for all the nested loops. (set_loop_bounds): Call recursively for all the nested loops. (set_delta): Ditto.