aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/decl.c
diff options
context:
space:
mode:
authorTobias Burnus <burnus@net-b.de>2013-01-28 15:37:20 +0100
committerMikael Morin <mikael@gcc.gnu.org>2013-01-28 14:37:20 +0000
commitdd8b9ddea2288c96124367bf66ce060eb1049872 (patch)
tree46bdc06e6d37edaa05bcf617578ec98dd1195a09 /gcc/fortran/decl.c
parente63f158158a16d77dd34492534e13c1a5ca27943 (diff)
downloadgcc-dd8b9ddea2288c96124367bf66ce060eb1049872.zip
gcc-dd8b9ddea2288c96124367bf66ce060eb1049872.tar.gz
gcc-dd8b9ddea2288c96124367bf66ce060eb1049872.tar.bz2
re PR fortran/53537 (Explicit IMPORT of renamed USE-associated symbol fails)
2013-01-28 Tobias Burnus <burnus@net-b.de> Mikael Morin <mikael@gcc.gnu.org> PR fortran/53537 * symbol.c (gfc_find_sym_tree): Don't look for the symbol outside an interface block. (gfc_get_ha_symtree): Let gfc_find_sym_tree lookup the parent namespace. * decl.c (gfc_match_data_decl): Ditto. (variable_decl): Remove undeclared type error. (gfc_match_import): Use renamed instead of original name. 2013-01-28 Tobias Burnus <burnus@net-b.de> Mikael Morin <mikael@gcc.gnu.org> PR fortran/53537 * gfortran.dg/import2.f90: Adjust undeclared type error messages. * gfortran.dg/import8.f90: Likewise. * gfortran.dg/interface_derived_type_1.f90: Likewise. * gfortran.dg/import10.f90: New test. * gfortran.dg/import11.f90: Likewise Co-Authored-By: Mikael Morin <mikael@gcc.gnu.org> From-SVN: r195506
Diffstat (limited to 'gcc/fortran/decl.c')
-rw-r--r--gcc/fortran/decl.c34
1 files changed, 5 insertions, 29 deletions
diff --git a/gcc/fortran/decl.c b/gcc/fortran/decl.c
index f2a9941..2a6342c 100644
--- a/gcc/fortran/decl.c
+++ b/gcc/fortran/decl.c
@@ -1979,30 +1979,6 @@ variable_decl (int elem)
goto cleanup;
}
- /* An interface body specifies all of the procedure's
- characteristics and these shall be consistent with those
- specified in the procedure definition, except that the interface
- may specify a procedure that is not pure if the procedure is
- defined to be pure(12.3.2). */
- if ((current_ts.type == BT_DERIVED || current_ts.type == BT_CLASS)
- && gfc_current_ns->proc_name
- && gfc_current_ns->proc_name->attr.if_source == IFSRC_IFBODY
- && current_ts.u.derived->ns != gfc_current_ns)
- {
- gfc_symtree *st;
- st = gfc_find_symtree (gfc_current_ns->sym_root, current_ts.u.derived->name);
- if (!(current_ts.u.derived->attr.imported
- && st != NULL
- && gfc_find_dt_in_generic (st->n.sym) == current_ts.u.derived)
- && !gfc_current_ns->has_import_set)
- {
- gfc_error ("The type of '%s' at %C has not been declared within the "
- "interface", name);
- m = MATCH_ERROR;
- goto cleanup;
- }
- }
-
if (check_function_name (name) == FAILURE)
{
m = MATCH_ERROR;
@@ -3240,14 +3216,14 @@ gfc_match_import (void)
return MATCH_ERROR;
}
- if (gfc_find_symtree (gfc_current_ns->sym_root,name))
+ if (gfc_find_symtree (gfc_current_ns->sym_root, name))
{
gfc_warning ("'%s' is already IMPORTed from host scoping unit "
"at %C.", name);
goto next_item;
}
- st = gfc_new_symtree (&gfc_current_ns->sym_root, sym->name);
+ st = gfc_new_symtree (&gfc_current_ns->sym_root, name);
st->n.sym = sym;
sym->refs++;
sym->attr.imported = 1;
@@ -3259,8 +3235,8 @@ gfc_match_import (void)
lower-case name contains the associated generic function. */
st = gfc_new_symtree (&gfc_current_ns->sym_root,
gfc_get_string ("%c%s",
- (char) TOUPPER ((unsigned char) sym->name[0]),
- &sym->name[1]));
+ (char) TOUPPER ((unsigned char) name[0]),
+ &name[1]));
st->n.sym = sym;
sym->refs++;
sym->attr.imported = 1;
@@ -4315,7 +4291,7 @@ gfc_match_data_decl (void)
goto ok;
gfc_find_symbol (current_ts.u.derived->name,
- current_ts.u.derived->ns->parent, 1, &sym);
+ current_ts.u.derived->ns, 1, &sym);
/* Any symbol that we find had better be a type definition
which has its components defined. */