http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51502
--- Comment #2 from Thomas Koenig <tkoenig at gcc dot gnu.org> 2011-12-11 20:56:54 UTC --- The problem occurs in expr.c: if (!pointer && gfc_implicit_pure (NULL) && gfc_impure_variable (sym)) gfc_current_ns->proc_name->attr.implicit_pure = 0; assumes that gfc_current_ns points to the current procedure, which is wrong in the case of blocks. Maybe it would make sense to have a global gfc_proc_name? Also, the logic in gfc_implicit_pure() appears to be wrong because it does not look for parent namespaces.