https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93497
kargl at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |kargl at gcc dot gnu.org
--- Comment #2 from kargl at gcc dot gnu.org ---
This seems to do the trick. Patch is against svn r280157.
Note 1. The error message in gfortran.dg/pr88025.f90 needs to
be adjusted.
Note 2. This causes a regression with gfortran.dg/mapping_1.f90,
because the reference to the contained pure function tricky_helper
occurs before tricky_helper has been parsed. Thus, gfortran assumes
that tricky_helper is an impure function, which is no allowed here.
Oh well. The regression can be avoided by re-ordering the functions
in the test case.
Index: gcc/fortran/decl.c
===================================================================
--- gcc/fortran/decl.c (revision 280157)
+++ gcc/fortran/decl.c (working copy)
@@ -1056,6 +1072,11 @@ char_len_param_value (gfc_expr **expr, bool *deferred)
if (!gfc_expr_check_typed (*expr, gfc_current_ns, false))
return MATCH_ERROR;
+
+ /* If gfortran gets an EXPR_OP, try to reduce it. This catches things
+ like CHARACTER(([1])). */
+ if ((*expr)->expr_type == EXPR_OP)
+ gfc_reduce_init_expr (*expr);
if ((*expr)->expr_type == EXPR_FUNCTION)
{