http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54208
janus at gcc dot gnu.org changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |janus at gcc dot gnu.org --- Comment #2 from janus at gcc dot gnu.org 2012-08-09 19:12:44 UTC --- The problem is apparently that, when trying to reduce the constant expression, we only resolve the expression itself (i.e. "ubound(arr,1)") but not the array spec of the symbol 'arr'. I find it surprising that this sort of thing has not been reported/fixed before (it may have been reported at least: I have not checked bugzilla for similar PRs). Anyway, the following patchlet gets rid of the error, but may possibly introduce regressions (unchecked): Index: gcc/fortran/resolve.c =================================================================== --- gcc/fortran/resolve.c (revision 190186) +++ gcc/fortran/resolve.c (working copy) @@ -5393,6 +5393,8 @@ resolve_variable (gfc_expr *e) && gfc_current_ns->parent->parent == sym->ns))) sym->attr.host_assoc = 1; + gfc_resolve_array_spec (sym->as, 0); + resolve_procedure: if (t == SUCCESS && resolve_procedure_expression (e) == FAILURE) t = FAILURE;