From: Jerry DeLisle <jvdelisle@verizon.net>
To: Fortran List <fortran@gcc.gnu.org>
Cc: gcc-patches <gcc-patches@gcc.gnu.org>
Subject: [patch, fortran] module that calls a contained function with an ENTRY point
Date: Sat, 28 Jul 2007 23:55:00 -0000 [thread overview]
Message-ID: <46ABB0C3.90200@verizon.net> (raw)
[-- Attachment #1: Type: text/plain, Size: 474 bytes --]
The attached patch resolves an infinite loop and segfault in generic_sym. The
result allows the original test case to compile correctly. The attached test
case compiles and executes correctly.
I will commit shortly as OKed by Paul on IRC.
Regression tested on x86-64-Gnu/Linux.
Regards,
Jerry
2007-07-28 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR fortran/31609
* resolve.c (generic_sym): Check for a same symbol and if so, return to
avoid infinite recursion.
[-- Attachment #2: pr31609.diff --]
[-- Type: text/x-patch, Size: 444 bytes --]
Index: resolve.c
===================================================================
--- resolve.c (revision 126937)
+++ resolve.c (working copy)
@@ -789,8 +789,16 @@ generic_sym (gfc_symbol *sym)
return 0;
gfc_find_symbol (sym->name, sym->ns->parent, 1, &s);
+
+ if (s != NULL)
+ {
+ if (s == sym)
+ return 0;
+ else
+ return generic_sym (s);
+ }
- return (s == NULL) ? 0 : generic_sym (s);
+ return 0;
}
[-- Attachment #3: entry_10.f90 --]
[-- Type: text/x-fortran, Size: 467 bytes --]
! { dg-do compile }
! PR31609 module that calls a contained function with an ENTRY point
! Test case derived from the PR
MODULE ksbin1_aux_mod
CONTAINS
SUBROUTINE sub
i = k()
END SUBROUTINE sub
FUNCTION j ()
print *, "in j"
j = 111
ENTRY k ()
print *, "in k"
k = 222
END FUNCTION j
END MODULE ksbin1_aux_mod
program testit
use ksbin1_aux_mod
l = j()
print *, l
l = k()
print *, l
end program testit
reply other threads:[~2007-07-28 21:14 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=46ABB0C3.90200@verizon.net \
--to=jvdelisle@verizon.net \
--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).