public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/vendors/redhat/heads/gcc-8-branch)] PR fortran/89574 - ICE in conv_function_val, at fortran/trans-expr.c:3792
@ 2020-09-17 17:12 Jakub Jelinek
0 siblings, 0 replies; only message in thread
From: Jakub Jelinek @ 2020-09-17 17:12 UTC (permalink / raw)
To: gcc-cvs
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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2020-09-17 17:12 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-17 17:12 [gcc(refs/vendors/redhat/heads/gcc-8-branch)] PR fortran/89574 - ICE in conv_function_val, at fortran/trans-expr.c:3792 Jakub Jelinek
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).