public inbox for fortran@gcc.gnu.org
 help / color / mirror / Atom feed
From: Steve Kargl <sgk@troutmask.apl.washington.edu>
To: fortran@gcc.gnu.org, gcc-patches@gcc.gnu.org
Subject: Re: [PATCH] PR fortran/78741 -- Detect clash of entry and subroutine name
Date: Thu, 15 Mar 2018 20:34:00 -0000	[thread overview]
Message-ID: <20180315203448.GA73417@troutmask.apl.washington.edu> (raw)
In-Reply-To: <20180315201802.GA73285@troutmask.apl.washington.edu>

[-- Attachment #1: Type: text/plain, Size: 207 bytes --]

On Thu, Mar 15, 2018 at 01:18:02PM -0700, Steve Kargl wrote:
> The patch is fairly slef-explanatory.

Well, it would be self-explanatory if I sent the
right patch.  (Two pathces touch same file).

-- 
Steve

[-- Attachment #2: pr78741.diff --]
[-- Type: text/x-diff, Size: 1446 bytes --]

Index: gcc/fortran/decl.c
===================================================================
--- gcc/fortran/decl.c	(revision 258571)
+++ gcc/fortran/decl.c	(working copy)
@@ -1189,8 +1209,13 @@ get_proc_name (const char *name, gfc_symbol **result, 
 	 accessible names.  */
       if (sym->attr.flavor != 0
 	  && sym->attr.proc != 0
-	  && (sym->attr.subroutine || sym->attr.function)
+	  && (sym->attr.subroutine || sym->attr.function || sym->attr.entry)
 	  && sym->attr.if_source != IFSRC_UNKNOWN)
+	gfc_error_now ("Procedure %qs at %C is already defined at %L",
+		       name, &sym->declared_at);
+
+      if (sym->attr.flavor != 0
+	  && sym->attr.entry && sym->attr.if_source != IFSRC_UNKNOWN)
 	gfc_error_now ("Procedure %qs at %C is already defined at %L",
 		       name, &sym->declared_at);
 
Index: gcc/testsuite/gfortran.dg/pr78741.f90
===================================================================
--- gcc/testsuite/gfortran.dg/pr78741.f90	(nonexistent)
+++ gcc/testsuite/gfortran.dg/pr78741.f90	(working copy)
@@ -0,0 +1,16 @@
+! { dg-do compile }
+! PR fortran/78741
+! Contributed by Gerhard Steinmetz <gerhard.steinmetz.fortran at t-online.de>
+subroutine s(n, x)
+   integer :: n
+   character(n) :: x
+   character, pointer :: z(:)
+   x = 'a'
+   return
+entry g(n, x)           ! { dg-error "is already defined" }
+   x = 'b'
+contains
+   subroutine g         ! { dg-error "(1)" }
+      z(1) = x(1:1)
+   end
+end

  reply	other threads:[~2018-03-15 20:34 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-15 20:18 Steve Kargl
2018-03-15 20:34 ` Steve Kargl [this message]
2018-03-16  1:26   ` Jerry DeLisle

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180315203448.GA73417@troutmask.apl.washington.edu \
    --to=sgk@troutmask.apl.washington.edu \
    --cc=fortran@gcc.gnu.org \
    --cc=gcc-patches@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).