* [PATCH] PR fortran/61765 -- Avoid ENTRY names in check of repeditive symbols
@ 2019-01-12 4:34 Steve Kargl
2019-01-12 11:14 ` Paul Richard Thomas
0 siblings, 1 reply; 2+ messages in thread
From: Steve Kargl @ 2019-01-12 4:34 UTC (permalink / raw)
To: fortran, gcc-patches
[-- Attachment #1: Type: text/plain, Size: 505 bytes --]
The attached patch has been tested on x86_64-*-freebsd. There
were no regression. The patch is less then obvious, but simple.
OK to commit?
2019-01-11 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/61765
* resolve.c (gfc_verify_binding_labels): Break if-elseif-elseif structure into independent
if's with a return to simplify logic. Avoid a check for ENTRY name with bind(c).
2019-01-11 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/61765
* gfortran.dg/pr61765.f90: New test.
--
Steve
[-- Attachment #2: pr61765.diff --]
[-- Type: text/x-diff, Size: 2635 bytes --]
Index: gcc/fortran/resolve.c
===================================================================
--- gcc/fortran/resolve.c (revision 267862)
+++ gcc/fortran/resolve.c (working copy)
@@ -11789,11 +11789,12 @@ gfc_verify_binding_labels (gfc_symbol *sym)
sym->binding_label, &sym->declared_at, &gsym->where);
/* Clear the binding label to prevent checking multiple times. */
sym->binding_label = NULL;
-
+ return;
}
- else if (sym->attr.flavor == FL_VARIABLE && module
- && (strcmp (module, gsym->mod_name) != 0
- || strcmp (sym->name, gsym->sym_name) != 0))
+
+ if (sym->attr.flavor == FL_VARIABLE && module
+ && (strcmp (module, gsym->mod_name) != 0
+ || strcmp (sym->name, gsym->sym_name) != 0))
{
/* This can only happen if the variable is defined in a module - if it
isn't the same module, reject it. */
@@ -11802,14 +11803,16 @@ gfc_verify_binding_labels (gfc_symbol *sym)
sym->name, module, sym->binding_label,
&sym->declared_at, &gsym->where, gsym->mod_name);
sym->binding_label = NULL;
+ return;
}
- else if ((sym->attr.function || sym->attr.subroutine)
- && ((gsym->type != GSYM_SUBROUTINE && gsym->type != GSYM_FUNCTION)
- || (gsym->defined && sym->attr.if_source != IFSRC_IFBODY))
- && sym != gsym->ns->proc_name
- && (module != gsym->mod_name
- || strcmp (gsym->sym_name, sym->name) != 0
- || (module && strcmp (module, gsym->mod_name) != 0)))
+
+ if ((sym->attr.function || sym->attr.subroutine)
+ && ((gsym->type != GSYM_SUBROUTINE && gsym->type != GSYM_FUNCTION)
+ || (gsym->defined && sym->attr.if_source != IFSRC_IFBODY))
+ && (sym != gsym->ns->proc_name && sym->attr.entry == 0)
+ && (module != gsym->mod_name
+ || strcmp (gsym->sym_name, sym->name) != 0
+ || (module && strcmp (module, gsym->mod_name) != 0)))
{
/* Print an error if the procedure is defined multiple times; we have to
exclude references to the same procedure via module association or
Index: gcc/testsuite/gfortran.dg/pr61765.f90
===================================================================
--- gcc/testsuite/gfortran.dg/pr61765.f90 (nonexistent)
+++ gcc/testsuite/gfortran.dg/pr61765.f90 (working copy)
@@ -0,0 +1,15 @@
+! { dg-do compile }
+ subroutine sub1(x)
+ integer, intent(in) :: x
+ entry sub1_c(x) bind(c)
+ end subroutine sub1
+
+ subroutine sub2_c(x) bind(c)
+ integer, intent(in) :: x
+ entry sub2(x)
+ end subroutine sub2_c
+
+ subroutine sub3_c(x) bind(c)
+ integer, intent(in) :: x
+ entry sub3_c_c(x) bind(c)
+ end subroutine sub3_c
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] PR fortran/61765 -- Avoid ENTRY names in check of repeditive symbols
2019-01-12 4:34 [PATCH] PR fortran/61765 -- Avoid ENTRY names in check of repeditive symbols Steve Kargl
@ 2019-01-12 11:14 ` Paul Richard Thomas
0 siblings, 0 replies; 2+ messages in thread
From: Paul Richard Thomas @ 2019-01-12 11:14 UTC (permalink / raw)
To: Steve Kargl; +Cc: fortran, gcc-patches
Hi Steve,
This is OK for trunk.
Thanks
Paul
On Sat, 12 Jan 2019 at 04:34, Steve Kargl
<sgk@troutmask.apl.washington.edu> wrote:
>
> The attached patch has been tested on x86_64-*-freebsd. There
> were no regression. The patch is less then obvious, but simple.
> OK to commit?
>
> 2019-01-11 Steven G. Kargl <kargl@gcc.gnu.org>
>
> PR fortran/61765
> * resolve.c (gfc_verify_binding_labels): Break if-elseif-elseif structure into independent
> if's with a return to simplify logic. Avoid a check for ENTRY name with bind(c).
>
> 2019-01-11 Steven G. Kargl <kargl@gcc.gnu.org>
>
> PR fortran/61765
> * gfortran.dg/pr61765.f90: New test.
>
> --
> Steve
--
"If you can't explain it simply, you don't understand it well enough"
- Albert Einstein
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-01-12 11:14 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-12 4:34 [PATCH] PR fortran/61765 -- Avoid ENTRY names in check of repeditive symbols Steve Kargl
2019-01-12 11:14 ` Paul Richard Thomas
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).