diff options
author | Steven G. Kargl <kargl@gcc.gnu.org> | 2015-11-13 00:14:32 +0000 |
---|---|---|
committer | Steven G. Kargl <kargl@gcc.gnu.org> | 2015-11-13 00:14:32 +0000 |
commit | 2050626ae819be7b6409b53b2fc641bcc37949f4 (patch) | |
tree | 266afc73a4ebb97826028912318f59d8755bbc21 /gcc | |
parent | be561c63f445cc8caa2aaa06f254d70a532bff03 (diff) | |
download | gcc-2050626ae819be7b6409b53b2fc641bcc37949f4.zip gcc-2050626ae819be7b6409b53b2fc641bcc37949f4.tar.gz gcc-2050626ae819be7b6409b53b2fc641bcc37949f4.tar.bz2 |
re PR fortran/68318 (ICE on duplicate entry declarations)
2015-11-12 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/68318
* decl.c (get_proc_name): Increment reference count for ENTRY.
While here, fix comment and use postfix ++ for consistency.
2015-11-12 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/68318
* gfortran.dg/pr68318_1.f90: New test.
* gfortran.dg/pr68318_2.f90: Ditto.
From-SVN: r230278
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/fortran/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/fortran/decl.c | 5 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/pr68318_1.f90 | 18 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/pr68318_2.f90 | 22 |
5 files changed, 55 insertions, 2 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index b0c10ad..4910f07 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,9 @@ +2015-11-12 Steven G. Kargl <kargl@gcc.gnu.org> + + PR fortran/68318 + * decl.c (get_proc_name): Increment reference count for ENTRY. + While here, fix comment and use postfix ++ for consistency. + 2015-11-11 Andrew MacLeod <amacleod@redhat.com> * array.c: Remove unused header files. diff --git a/gcc/fortran/decl.c b/gcc/fortran/decl.c index 157eb23..c10557e 100644 --- a/gcc/fortran/decl.c +++ b/gcc/fortran/decl.c @@ -925,6 +925,7 @@ get_proc_name (const char *name, gfc_symbol **result, bool module_fcn_entry) 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; } } @@ -971,7 +972,7 @@ get_proc_name (const char *name, gfc_symbol **result, bool module_fcn_entry) /* 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 @@ -9051,7 +9052,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; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 86054c4..6531a10 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2015-11-12 Steven G. Kargl <kargl@gcc.gnu.org> + + PR fortran/68318 + * gfortran.dg/pr68318_1.f90: New test. + * gfortran.dg/pr68318_2.f90: Ditto. + 2015-11-12 James Norris <jnorris@codesourcery.com> Joseph Myers <joseph@codesourcery.com> diff --git a/gcc/testsuite/gfortran.dg/pr68318_1.f90 b/gcc/testsuite/gfortran.dg/pr68318_1.f90 new file mode 100644 index 0000000..1a3d594 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr68318_1.f90 @@ -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" } + diff --git a/gcc/testsuite/gfortran.dg/pr68318_2.f90 b/gcc/testsuite/gfortran.dg/pr68318_2.f90 new file mode 100644 index 0000000..451b28f --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr68318_2.f90 @@ -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" } |