OSDN Git Service

2008-09-06 Steven G. Kargl <kargls@comcast.net>
authorburnus <burnus@138bc75d-0d04-0410-961f-82ee72b054a4>
Sat, 6 Sep 2008 15:11:29 +0000 (15:11 +0000)
committerburnus <burnus@138bc75d-0d04-0410-961f-82ee72b054a4>
Sat, 6 Sep 2008 15:11:29 +0000 (15:11 +0000)
        PR fortran/33229
        * resolve.c (resolve_function): An intrinsic subroutine should
        * not be
        called as a function.

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

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

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@140061 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/fortran/ChangeLog
gcc/fortran/resolve.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/intrinsic_subroutine.f90 [new file with mode: 0644]

index 2008990..e3f2dcd 100644 (file)
@@ -1,3 +1,9 @@
+2008-09-06  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-05  Daniel Kraft  <d@domob.eu>
 
        PR fortran/35837
index e28d704..485d331 100644 (file)
@@ -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);
index 9ea373a..c094425 100644 (file)
@@ -1,3 +1,8 @@
+2008-09-06  Steven G. Kargl  <kargls@comcast.net>
+
+       PR fortran/33229
+       * gfortran.dg/intrinsic_subroutine.f90: New test.
+
 2008-09-06  Richard Sandiford  <rdsandiford@googlemail.com>
 
        * gcc.target/mips/mips.exp (dg-mips-options): Make
@@ -26,8 +31,8 @@
 
 2008-09-05  Douglas Gregor  <doug.gregor@gmail.com>
 
-       PR c++/37342
-       * g++.dg/other/canon-37342.C: New.
+       PR c++/37342
+       * g++.dg/other/canon-37342.C: New.
        
 2008-09-05  Joseph Myers  <joseph@codesourcery.com>
 
 2008-09-02  Victor Kaplansky  <victork@il.ibm.com>
 
        * gcc.dg/fastmath-2.c: New.
-    
+
 2008-09-02  Jakub Jelinek  <jakub@redhat.com>
 
        PR tree-optimization/37095
diff --git a/gcc/testsuite/gfortran.dg/intrinsic_subroutine.f90 b/gcc/testsuite/gfortran.dg/intrinsic_subroutine.f90
new file mode 100644 (file)
index 0000000..103ff3b
--- /dev/null
@@ -0,0 +1,7 @@
+! { dg-do compile }
+! PR 33229
+implicit none
+intrinsic cpu_time
+real :: time
+print *, CPU_TIME(TIME)  ! { dg-error "Intrinsic subroutine" }
+end