aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/primary.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/fortran/primary.c')
-rw-r--r--gcc/fortran/primary.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/gcc/fortran/primary.c b/gcc/fortran/primary.c
index 1428f4c..6f61ad7 100644
--- a/gcc/fortran/primary.c
+++ b/gcc/fortran/primary.c
@@ -2283,6 +2283,17 @@ match_variable (gfc_expr ** result, int equiv_flag, int host_flag)
locus where;
match m;
+ /* Since nothing has any business being an lvalue in a module
+ specification block, an interface block or a contains section,
+ we force the changed_symbols mechanism to work by setting
+ host_flag to 0. This prevents valid symbols that have the name
+ of keywords, such as 'end', being turned into variables by
+ failed matching to assignments for, eg., END INTERFACE. */
+ if (gfc_current_state () == COMP_MODULE
+ || gfc_current_state () == COMP_INTERFACE
+ || gfc_current_state () == COMP_CONTAINS)
+ host_flag = 0;
+
m = gfc_match_sym_tree (&st, host_flag);
if (m != MATCH_YES)
return m;