aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/module.c
diff options
context:
space:
mode:
authorPaul Thomas <pault@gcc.gnu.org>2005-09-18 05:18:54 +0000
committerPaul Thomas <pault@gcc.gnu.org>2005-09-18 05:18:54 +0000
commit6cda231ed91ad7e3c1b5357b0ffc04a925ff34f7 (patch)
tree5a25bc941590a75d5331f4e5dd69bba6e6730d72 /gcc/fortran/module.c
parentb695055179b834455a2fe617ea8922621637429e (diff)
downloadgcc-6cda231ed91ad7e3c1b5357b0ffc04a925ff34f7.zip
gcc-6cda231ed91ad7e3c1b5357b0ffc04a925ff34f7.tar.gz
gcc-6cda231ed91ad7e3c1b5357b0ffc04a925ff34f7.tar.bz2
re PR fortran/16861 ([4.0 only] segfault with doubly used module)
2005-09-18 Paul Thomas <pault@gcc.gnu.org> PR fortran/16861 * module.c (read_module): Give symbols from module procedures different true_name entries to those from the module proper. 2005-09-18 Paul Thomas <pault@gcc.gnu.org> PR fortran/16861 * gfortran.dg/nested_modules_2.f90: New test. From-SVN: r104388
Diffstat (limited to 'gcc/fortran/module.c')
-rw-r--r--gcc/fortran/module.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/gcc/fortran/module.c b/gcc/fortran/module.c
index 5117050..8f225aa 100644
--- a/gcc/fortran/module.c
+++ b/gcc/fortran/module.c
@@ -3099,7 +3099,7 @@ read_module (void)
const char *p;
char name[GFC_MAX_SYMBOL_LEN + 1];
gfc_intrinsic_op i;
- int ambiguous, symbol, j, nuse;
+ int ambiguous, j, nuse, series, symbol;
pointer_info *info;
gfc_use_rename *u;
gfc_symtree *st;
@@ -3142,6 +3142,14 @@ read_module (void)
being loaded again. */
sym = find_true_name (info->u.rsym.true_name, info->u.rsym.module);
+
+ /* If a module contains subroutines with assumed shape dummy
+ arguments, the symbols for indices need to be different from
+ from those in the module proper(ns = 1). */
+ if (sym !=NULL && info->u.rsym.ns != 1)
+ sym = find_true_name (info->u.rsym.true_name,
+ gfc_get_string ("%s@%d",module_name, series++));
+
if (sym == NULL)
continue;
@@ -3485,11 +3493,6 @@ write_symbol1 (pointer_info * p)
if (p->type != P_SYMBOL || p->u.wsym.state != NEEDS_WRITE)
return 0;
- /* FIXME: This shouldn't be necessary, but it works around
- deficiencies in the module loader or/and symbol handling. */
- if (p->u.wsym.sym->module == NULL && p->u.wsym.sym->attr.dummy)
- p->u.wsym.sym->module = gfc_get_string (module_name);
-
p->u.wsym.state = WRITTEN;
write_symbol (p->integer, p->u.wsym.sym);