public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Jakub Jelinek <jakub@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc(refs/vendors/redhat/heads/gcc-8-branch)] PR fortran/89574 - ICE in conv_function_val, at fortran/trans-expr.c:3792 Date: Thu, 17 Sep 2020 17:12:14 +0000 (GMT) [thread overview] Message-ID: <20200917171214.E206C398B8B0@sourceware.org> (raw) https://gcc.gnu.org/g:9eb343c0782078badde5fa839c79e3e7dc589165 commit 9eb343c0782078badde5fa839c79e3e7dc589165 Author: Harald Anlauf <anlauf@gmx.de> Date: Tue Jul 21 21:37:30 2020 +0200 PR fortran/89574 - ICE in conv_function_val, at fortran/trans-expr.c:3792 When checking for an external procedure from the same file, do not consider symbols from different modules. gcc/fortran/ PR fortran/89574 * trans-decl.c (gfc_get_extern_function_decl): Check whether a symbol belongs to a different module. (cherry picked from commit 28f2a080cc27531a8c78aec9f44aeff4961c2a4c) Diff: --- gcc/fortran/trans-decl.c | 7 ++++++- gcc/testsuite/gfortran.dg/pr89574.f90 | 29 +++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/gcc/fortran/trans-decl.c b/gcc/fortran/trans-decl.c index 3780d27a9f6..46cc742e23f 100644 --- a/gcc/fortran/trans-decl.c +++ b/gcc/fortran/trans-decl.c @@ -2064,12 +2064,17 @@ gfc_get_extern_function_decl (gfc_symbol * sym, gfc_actual_arglist *actual_args) if (gsym && !gsym->bind_c) gsym = NULL; } - else + else if (sym->module == NULL) { gsym = gfc_find_gsymbol (gfc_gsym_root, sym->name); if (gsym && gsym->bind_c) gsym = NULL; } + else + { + /* Procedure from a different module. */ + gsym = NULL; + } if (gsym && !gsym->defined) gsym = NULL; diff --git a/gcc/testsuite/gfortran.dg/pr89574.f90 b/gcc/testsuite/gfortran.dg/pr89574.f90 new file mode 100644 index 00000000000..48dd0680a48 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr89574.f90 @@ -0,0 +1,29 @@ +! { dg-do compile } +! PR fortran/89574 - ICE in conv_function_val, at fortran/trans-expr.c:3792 + +module mod1 +contains + subroutine init + end subroutine +end module + +module mod2 +contains + subroutine init + end subroutine +end module + +module init + use mod1, only : test_init1 => init + use mod2, only : test_init2 => init + implicit none +contains + subroutine sub + call test_init1 + call test_init2 + call init + contains + subroutine init + end subroutine + end subroutine +end module
reply other threads:[~2020-09-17 17:12 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=20200917171214.E206C398B8B0@sourceware.org \ --to=jakub@gcc.gnu.org \ --cc=gcc-cvs@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: linkBe 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).