aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/module.c
diff options
context:
space:
mode:
authorPaul Thomas <pault@gcc.gnu.org>2007-11-27 19:21:52 +0000
committerPaul Thomas <pault@gcc.gnu.org>2007-11-27 19:21:52 +0000
commit0e5a218b31eb720caa70b19439e26f658f151070 (patch)
treebe82a309f3817052399ef60052788c41bf329635 /gcc/fortran/module.c
parentf98e89380fd7ca4035221eaa9a8efad0e420d1b5 (diff)
downloadgcc-0e5a218b31eb720caa70b19439e26f658f151070.zip
gcc-0e5a218b31eb720caa70b19439e26f658f151070.tar.gz
gcc-0e5a218b31eb720caa70b19439e26f658f151070.tar.bz2
re PR fortran/33541 (gfortran wrongly imports renamed-use-associated symbol unrenamed)
2007-11-27 Paul Thomas <pault@gcc.gnu.org> PR fortran/33541 *interface.c (compare_actual_formal): Exclude assumed size arrays from the possibility of scalar to array mapping. * decl.c (get_proc_name): Fix whitespace problem. PR fortran/34231 * gfortran.h : Add 'use_rename' bit to symbol_attribute. * module.c : Add 'renamed' field to pointer_info.u.rsym. (load_generic_interfaces): Add 'renamed' that is set after the number_use_names is called. This is used to set the attribute use_rename, which, in its turn identifies those symbols that have not been renamed. (load_needed): If pointer_info.u.rsym->renamed is set, then set the use_rename attribute of the symbol. (read_module): Correct an erroneous use of use_flag. Use the renamed flag and the use_rename attribute to determine which symbols are not renamed. 2007-11-27 Paul Thomas <pault@gcc.gnu.org> PR fortran/33541 * gfortran.dg/use_11.f90: New test. PR fortran/34231 * gfortran.dg/generic_15.f90: New test. From-SVN: r130471
Diffstat (limited to 'gcc/fortran/module.c')
-rw-r--r--gcc/fortran/module.c22
1 files changed, 16 insertions, 6 deletions
diff --git a/gcc/fortran/module.c b/gcc/fortran/module.c
index 5f03b497..a81067c 100644
--- a/gcc/fortran/module.c
+++ b/gcc/fortran/module.c
@@ -136,7 +136,7 @@ typedef struct pointer_info
enum
{ UNUSED, NEEDED, USED }
state;
- int ns, referenced;
+ int ns, referenced, renamed;
module_locus where;
fixup_t *stfixup;
gfc_symtree *symtree;
@@ -3260,7 +3260,7 @@ load_generic_interfaces (void)
char name[GFC_MAX_SYMBOL_LEN + 1], module[GFC_MAX_SYMBOL_LEN + 1];
gfc_symbol *sym;
gfc_interface *generic = NULL;
- int n, i;
+ int n, i, renamed;
mio_lparen ();
@@ -3272,6 +3272,7 @@ load_generic_interfaces (void)
mio_internal_string (module);
n = number_use_names (name, false);
+ renamed = n ? 1 : 0;
n = n ? n : 1;
for (i = 1; i <= n; i++)
@@ -3300,7 +3301,9 @@ load_generic_interfaces (void)
{
/* Make symtree inaccessible by renaming if the symbol has
been added by a USE statement without an ONLY(11.3.2). */
- if (st && !st->n.sym->attr.use_only && only_flag
+ if (st && only_flag
+ && !st->n.sym->attr.use_only
+ && !st->n.sym->attr.use_rename
&& strcmp (st->n.sym->module, module_name) == 0)
st->name = gfc_get_string ("hidden.%s", name);
else if (st)
@@ -3342,6 +3345,7 @@ load_generic_interfaces (void)
}
sym->attr.use_only = only_flag;
+ sym->attr.use_rename = renamed;
if (i == 1)
{
@@ -3523,6 +3527,8 @@ load_needed (pointer_info *p)
sym->attr.use_assoc = 1;
if (only_flag)
sym->attr.use_only = 1;
+ if (p->u.rsym.renamed)
+ sym->attr.use_rename = 1;
return 1;
}
@@ -3666,6 +3672,8 @@ read_module (void)
/* See how many use names there are. If none, go through the start
of the loop at least once. */
nuse = number_use_names (name, false);
+ info->u.rsym.renamed = nuse ? 1 : 0;
+
if (nuse == 0)
nuse = 1;
@@ -3679,7 +3687,7 @@ read_module (void)
/* Skip symtree nodes not in an ONLY clause, unless there
is an existing symtree loaded from another USE statement. */
- if (p == NULL && only_flag)
+ if (p == NULL)
{
st = gfc_find_symtree (gfc_current_ns->sym_root, name);
if (st != NULL)
@@ -3691,7 +3699,7 @@ read_module (void)
this symbol, which is not in an ONLY clause, must not be
added to the namespace(11.3.2). Note that find_symbol
only returns the first occurrence that it finds. */
- if (!only_flag
+ if (!only_flag && !info->u.rsym.renamed
&& strcmp (name, module_name) != 0
&& find_symbol (gfc_current_ns->sym_root, name,
module_name, 0))
@@ -3712,7 +3720,9 @@ read_module (void)
/* Make symtree inaccessible by renaming if the symbol has
been added by a USE statement without an ONLY(11.3.2). */
- if (st && !st->n.sym->attr.use_only && only_flag
+ if (st && only_flag
+ && !st->n.sym->attr.use_only
+ && !st->n.sym->attr.use_rename
&& strcmp (st->n.sym->module, module_name) == 0)
st->name = gfc_get_string ("hidden.%s", name);