summaryrefslogtreecommitdiff
path: root/gcc/fortran/match.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/fortran/match.c')
-rw-r--r--gcc/fortran/match.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/gcc/fortran/match.c b/gcc/fortran/match.c
index d4ba350ab59..22b0d7d42f7 100644
--- a/gcc/fortran/match.c
+++ b/gcc/fortran/match.c
@@ -4913,6 +4913,15 @@ gfc_match_st_function (void)
sym->value = expr;
+ if ((gfc_current_state () == COMP_FUNCTION
+ || gfc_current_state () == COMP_SUBROUTINE)
+ && gfc_state_stack->previous->state == COMP_INTERFACE)
+ {
+ gfc_error ("Statement function at %L cannot appear within an INTERFACE",
+ &expr->where);
+ return MATCH_ERROR;
+ }
+
if (!gfc_notify_std (GFC_STD_F95_OBS, "Statement function at %C"))
return MATCH_ERROR;