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)
{
--- /dev/null
+! { 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