On 20.03.23 21:57, Harald Anlauf via Gcc-patches wrote:
--- a/gcc/fortran/decl.cc +++ b/gcc/fortran/decl.cc @@ -9998,6 +9998,7 @@ gfc_match_modproc (void) if ((gfc_state_stack->state != COMP_INTERFACE && gfc_state_stack->state != COMP_CONTAINS) || gfc_state_stack->previous == NULL + || !current_interface.type || current_interface.type == INTERFACE_NAMELESS || current_interface.type == INTERFACE_ABSTRACT) {
First, I do not like '!var' comparisons for enum values, only for Booleans/logicals and pointer. Secondly, I am not sure that it is really guaranteed that the value is 0. I think something like the following makes more sense and, as just tried, it also regtests (w/ your testcase included). If you agree, feel free to package and commit it. diff --git a/gcc/fortran/decl.cc b/gcc/fortran/decl.cc index c8f0bb83c2c..233bf244d62 100644 --- a/gcc/fortran/decl.cc +++ b/gcc/fortran/decl.cc @@ -9996,7 +9996,8 @@ gfc_match_modproc (void) 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) Thanks for working on this and all the other issues! Tobias ----------------- Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht München, HRB 106955