https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99147
anlauf at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed| |2021-02-18
Status|UNCONFIRMED |NEW
CC| |anlauf at gcc dot gnu.org
Priority|P3 |P4
Ever confirmed|0 |1
--- Comment #1 from anlauf at gcc dot gnu.org ---
Confirmed using valgrind.
Simply reversing the conditions seems to resolve the issue:
diff --git a/gcc/fortran/symbol.c b/gcc/fortran/symbol.c
index 3b988d1be22..e982374d9d1 100644
--- a/gcc/fortran/symbol.c
+++ b/gcc/fortran/symbol.c
@@ -1772,8 +1772,8 @@ gfc_add_flavor (symbol_attribute *attr, sym_flavor f,
const char *name,
/* Copying a procedure dummy argument for a module procedure in a
submodule results in the flavor being copied and would result in
an error without this. */
- if (gfc_new_block && gfc_new_block->abr_modproc_decl
- && attr->flavor == f && f == FL_PROCEDURE)
+ if (attr->flavor == f && f == FL_PROCEDURE
+ && gfc_new_block && gfc_new_block->abr_modproc_decl)
return true;
if (attr->flavor != FL_UNKNOWN)