aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/resolve.c
diff options
context:
space:
mode:
authorPaul Thomas <pault@gcc.gnu.org>2007-07-10 05:11:00 +0000
committerPaul Thomas <pault@gcc.gnu.org>2007-07-10 05:11:00 +0000
commite7c8ff569c1183610a1ff25c8fb4756be078dc75 (patch)
tree1cdd07b79dbb5fed84581b617a6a44a8f7aa043b /gcc/fortran/resolve.c
parent89ab46599d72839cb0b823baaaad4b76b384a543 (diff)
downloadgcc-e7c8ff569c1183610a1ff25c8fb4756be078dc75.zip
gcc-e7c8ff569c1183610a1ff25c8fb4756be078dc75.tar.gz
gcc-e7c8ff569c1183610a1ff25c8fb4756be078dc75.tar.bz2
re PR fortran/32157 (intrinsic function name conflicts with subroutine if present in the same file)
2007-07-10 Paul Thomas <pault@gcc.gnu.org> PR fortran/32157 * resolve.c (is_external_proc): New function. Adds test that the symbol is not an intrinsic procedure. * (resolve_function, resolve_call): Replace logical statements with call to is_external_proc. PR fortran/32689 * simplify.c (gfc_simplify_transfer): If mold has rank, the result is an array. PR fortran/32634 * module.c (write_generic): Write the local name of the interface. 2007-07-10 Paul Thomas <pault@gcc.gnu.org> PR fortran/32157 * gfortran.dg/overload_2.f90: New test. PR fortran/32689 * gfortran.dg/transfer_simplify_5.f90 PR fortran/32634 * gfortran.dg/interface_15.f90: New test. From-SVN: r126509
Diffstat (limited to 'gcc/fortran/resolve.c')
-rw-r--r--gcc/fortran/resolve.c32
1 files changed, 20 insertions, 12 deletions
diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c
index 97bcc85..911d5ec 100644
--- a/gcc/fortran/resolve.c
+++ b/gcc/fortran/resolve.c
@@ -1552,6 +1552,22 @@ set_type:
}
+/* Return true, if the symbol is an external procedure. */
+static bool
+is_external_proc (gfc_symbol *sym)
+{
+ if (!sym->attr.dummy && !sym->attr.contained
+ && !(sym->attr.intrinsic
+ || gfc_intrinsic_name (sym->name, sym->attr.subroutine))
+ && sym->attr.proc != PROC_ST_FUNCTION
+ && !sym->attr.use_assoc
+ && sym->name)
+ return true;
+ else
+ return false;
+}
+
+
/* Figure out if a function reference is pure or not. Also set the name
of the function for a potential error message. Return nonzero if the
function is PURE, zero if not. */
@@ -1893,12 +1909,8 @@ resolve_function (gfc_expr *expr)
return FAILURE;
}
- /* If the procedure is not internal, a statement function or a module
- procedure,it must be external and should be checked for usage. */
- if (sym && !sym->attr.dummy && !sym->attr.contained
- && sym->attr.proc != PROC_ST_FUNCTION
- && !sym->attr.use_assoc
- && sym->name )
+ /* If the procedure is external, check for usage. */
+ if (sym && is_external_proc (sym))
resolve_global_procedure (sym, &expr->where, 0);
/* Switch off assumed size checking and do this again for certain kinds
@@ -2490,12 +2502,8 @@ resolve_call (gfc_code *c)
return FAILURE;
}
- /* If the procedure is not internal or module, it must be external and
- should be checked for usage. */
- if (c->symtree && c->symtree->n.sym
- && !c->symtree->n.sym->attr.dummy
- && !c->symtree->n.sym->attr.contained
- && !c->symtree->n.sym->attr.use_assoc)
+ /* If external, check for usage. */
+ if (c->symtree && is_external_proc (c->symtree->n.sym))
resolve_global_procedure (c->symtree->n.sym, &c->loc, 1);
/* Subroutines without the RECURSIVE attribution are not allowed to