https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88228
--- Comment #2 from kargl at gcc dot gnu.org ---
Index: gcc/fortran/expr.c
===================================================================
--- gcc/fortran/expr.c (revision 266386)
+++ gcc/fortran/expr.c (working copy)
@@ -2688,6 +2688,9 @@ check_transformational (gfc_expr *e)
static match
check_null (gfc_expr *e)
{
+ if (e->expr_type == EXPR_CONSTANT)
+ return MATCH_NO;
+
if (strcmp ("null", e->symtree->n.sym->name) != 0)
return MATCH_NO;
@@ -2793,10 +2796,15 @@ gfc_check_init_expr (gfc_expr *e)
&& (m = check_transformational (e)) == MATCH_NO
&& (m = check_elemental (e)) == MATCH_NO)
{
- gfc_error ("Intrinsic function %qs at %L is not permitted "
- "in an initialization expression",
- e->symtree->n.sym->name, &e->where);
- m = MATCH_ERROR;
+ if (e->expr_type == EXPR_CONSTANT)
+ return true;
+ else
+ {
+ gfc_error ("Intrinsic function %qs at %L is not permitted "
+ "in an initialization expression",
+ e->symtree->n.sym->name, &e->where);
+ m = MATCH_ERROR;
+ }
}
if (m == MATCH_ERROR)