===================================================================
@@ -926,6 +926,7 @@ get_proc_name (const char *name, gfc_sym
gfc_find_sym_tree (name, gfc_current_ns, 0, &st);
st->n.sym = *result;
st = gfc_get_unique_symtree (gfc_current_ns);
+ sym->refs++;
st->n.sym = sym;
}
}
@@ -972,7 +973,7 @@ get_proc_name (const char *name, gfc_sym
/* Trap another encompassed procedure with the same name. All
these conditions are necessary to avoid picking up an entry
whose name clashes with that of the encompassing procedure;
- this is handled using gsymbols to register unique,globally
+ this is handled using gsymbols to register unique, globally
accessible names. */
if (sym->attr.flavor != 0
&& sym->attr.proc != 0
@@ -9052,7 +9053,7 @@ gfc_match_final_decl (void)
/* Add this symbol to the list of finalizers. */
gcc_assert (block->f2k_derived);
- ++sym->refs;
+ sym->refs++;
f = XCNEW (gfc_finalizer);
f->proc_sym = sym;
f->proc_tree = NULL;
===================================================================
@@ -0,0 +1,18 @@
+! { dg-do compile }
+! { dg-options "-O0"
+! PR fortran/68318
+! Original code submitted by Gerhard Steinmetz
+! <gerhard dot steinmetz dot fortran at t-online dot de>
+!
+module m
+ implicit none
+contains
+ subroutine s1
+ entry e ! { dg-error "(2)" }
+ end
+ subroutine s2
+ entry e ! { dg-error "is already defined" }
+ end
+end module
+! { dg-prune-output "Duplicate ENTRY attribute specified" }
+
===================================================================
@@ -0,0 +1,22 @@
+! { dg-do compile }
+! PR fortran/68318
+! Original code submitted by Gerhard Steinmetz
+! <gerhard dot steinmetz dot fortran at t-online dot de>
+!
+module m1
+ implicit none
+contains
+ subroutine s1
+ entry e
+ end
+end module
+
+module m2
+ use m1 ! { dg-error "(2)" }
+ implicit none
+contains
+ subroutine s2
+ entry e ! { dg-error "is already defined" }
+ end
+end module
+! { dg-prune-output "Cannot change attribute" }