https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85138
--- Comment #9 from Thomas Koenig <tkoenig at gcc dot gnu.org> --- OK, so I am beginning to understand... Part of the problem seems that, in check_pure_function, else if (gfc_pure (NULL)) { gfc_error ("Reference to impure function %qs at %L " "within a PURE procedure", name, &e->where); return false; } is checking the current namespace for PUREness; this seems not to be initialized when gfc_reduce_init_expr (which in turn calls gfc_resolve_expr) is called.