* [PATCH] PR fortran/65453 -- procedure statement vs subprogram name clash
@ 2018-03-17 0:30 Steve Kargl
2018-03-18 15:25 ` Thomas König
0 siblings, 1 reply; 2+ messages in thread
From: Steve Kargl @ 2018-03-17 0:30 UTC (permalink / raw)
To: fortran, gcc-patches
[-- Attachment #1: Type: text/plain, Size: 440 bytes --]
The attached patch fixes an ICE by detecting a name
clash between a procedure statement and a contained
subprogram. Regression tested on x86_64-*-freebsd.
2018-03-16 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/65453
* decl.c (get_proc_name): Catch clash between a procedure statement
and a contained subprogram
2018-03-16 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/65453
* gfortran.dg/pr65453.f90: New test.
--
Steve
[-- Attachment #2: pr65453.diff --]
[-- Type: text/x-diff, Size: 1185 bytes --]
Index: gcc/fortran/decl.c
===================================================================
--- gcc/fortran/decl.c (revision 258607)
+++ gcc/fortran/decl.c (working copy)
@@ -1219,6 +1219,12 @@ get_proc_name (const char *name, gfc_symbol **result,
gfc_error_now ("Procedure %qs at %C is already defined at %L",
name, &sym->declared_at);
+ if (sym->attr.external && sym->attr.procedure
+ && gfc_current_state () == COMP_CONTAINS)
+ gfc_error_now ("Contained procedure %qs at %C clashes with "
+ "procedure defined at %L",
+ name, &sym->declared_at);
+
/* Trap a procedure with a name the same as interface in the
encompassing scope. */
if (sym->attr.generic != 0
Index: gcc/testsuite/gfortran.dg/pr65453.f90
===================================================================
--- gcc/testsuite/gfortran.dg/pr65453.f90 (nonexistent)
+++ gcc/testsuite/gfortran.dg/pr65453.f90 (working copy)
@@ -0,0 +1,8 @@
+! { dg-do compile }
+! PR fortran/65453
+! Contributed by Tobias Burnus <burnus at gcc.gnu.org>
+procedure() :: foo ! { dg-error "(1)" }
+ contains
+ subroutine foo() ! { dg-error "clashes with procedure" }
+ end
+end
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] PR fortran/65453 -- procedure statement vs subprogram name clash
2018-03-17 0:30 [PATCH] PR fortran/65453 -- procedure statement vs subprogram name clash Steve Kargl
@ 2018-03-18 15:25 ` Thomas König
0 siblings, 0 replies; 2+ messages in thread
From: Thomas König @ 2018-03-18 15:25 UTC (permalink / raw)
To: sgk, fortran, gcc-patches
Hi Steve,
> The attached patch fixes an ICE by detecting a name
> clash between a procedure statement and a contained
> subprogram. Regression tested on x86_64-*-freebsd.
The patch is OK.
Thanks!
Regards
Thomas
(In case anybody is wondering about my e-mail address: I have a
new one and am switching over lists etc to this one, so I
can have a chance of switching my provider).
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-03-18 15:25 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-17 0:30 [PATCH] PR fortran/65453 -- procedure statement vs subprogram name clash Steve Kargl
2018-03-18 15:25 ` Thomas König
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).