This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] PR fortran/33229 -- Fix intrinsic subroutine as function call.


Regression tested on x86_64-*-freebsd8.0.  There are no new regressions.

The code and ChangeLog are fairly self-explanatory.

2008-09-04  Steven G. Kargl  <kargls@comcast.net>

	PR fortran/33229
	* resolve.c (resolve_function): An intrinsic subroutine should not be
	called as a function.

2008-09-04  Steven G. Kargl  <kargls@comcast.net>

    PR fortran/33229
	* gfortran.dg/intrinsic_subroutine.f90: New test.


-- 
Steve
Index: resolve.c
===================================================================
--- resolve.c	(revision 140035)
+++ resolve.c	(working copy)
@@ -2204,6 +2204,16 @@ resolve_function (gfc_expr *expr)
   if (expr->symtree)
     sym = expr->symtree->n.sym;
 
+  if (sym && sym->attr.intrinsic
+      && !gfc_find_function (sym->name)
+      && gfc_find_subroutine (sym->name)
+      && sym->attr.function)
+    {
+      gfc_error ("intrinsic subroutine '%s' used as "
+		  "a function at %L", sym->name, &expr->where);
+      return FAILURE;
+    }
+
   if (sym && sym->attr.flavor == FL_VARIABLE)
     {
       gfc_error ("'%s' at %L is not a function", sym->name, &expr->where);

Attachment: intrinsic_subroutine.f90
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]