diff options
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/fortran/decl.cc | 7 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/pr99036.f90 | 9 |
2 files changed, 13 insertions, 3 deletions
diff --git a/gcc/fortran/decl.cc b/gcc/fortran/decl.cc index c8f0bb8..233bf24 100644 --- a/gcc/fortran/decl.cc +++ b/gcc/fortran/decl.cc @@ -9995,9 +9995,10 @@ gfc_match_modproc (void) gfc_namespace *module_ns; gfc_interface *old_interface_head, *interface; - if ((gfc_state_stack->state != COMP_INTERFACE - && gfc_state_stack->state != COMP_CONTAINS) - || gfc_state_stack->previous == NULL + if (gfc_state_stack->previous == NULL + || (gfc_state_stack->state != COMP_INTERFACE + && (gfc_state_stack->state != COMP_CONTAINS + || gfc_state_stack->previous->state != COMP_INTERFACE)) || current_interface.type == INTERFACE_NAMELESS || current_interface.type == INTERFACE_ABSTRACT) { diff --git a/gcc/testsuite/gfortran.dg/pr99036.f90 b/gcc/testsuite/gfortran.dg/pr99036.f90 new file mode 100644 index 0000000..a6e396f --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr99036.f90 @@ -0,0 +1,9 @@ +! { dg-do compile } +! PR fortran/99036 - ICE in gfc_current_interface_head +! Contributed by G. Steinmetz + +module m +contains + module procedure s ! { dg-error "must be in a generic module interface" } + end +end |