re PR fortran/33162 (INTRINSIC functions as ACTUAL argument)
authorJerry DeLisle <jvdelisle@gcc.gnu.org>
Wed, 31 Oct 2007 14:30:48 +0000 (14:30 +0000)
committerJerry DeLisle <jvdelisle@gcc.gnu.org>
Wed, 31 Oct 2007 14:30:48 +0000 (14:30 +0000)
2007-10-31  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

PR fortran/33162
* gfortran.dg/interface_19.f90: New.
* gfortran.dg/interface_20.f90: New.
* gfortran.dg/interface_21.f90: New.

From-SVN: r129799

gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/interface_19.f90 [new file with mode: 0644]
gcc/testsuite/gfortran.dg/interface_20.f90 [new file with mode: 0644]
gcc/testsuite/gfortran.dg/interface_21.f90 [new file with mode: 0644]

index 687dd19..b9307a1 100644 (file)
@@ -1,3 +1,10 @@
+2007-10-31  Jerry DeLisle  <jvdelisle@gcc.gnu.org>
+
+       PR fortran/33162
+       * gfortran.dg/interface_19.f90: New.
+       * gfortran.dg/interface_20.f90: New.
+       * gfortran.dg/interface_21.f90: New.
+       
 2007-10-31  Sebastian Pop  <sebastian.pop@amd.com>
 
        PR tree-optimization/32377
diff --git a/gcc/testsuite/gfortran.dg/interface_19.f90 b/gcc/testsuite/gfortran.dg/interface_19.f90
new file mode 100644 (file)
index 0000000..2d72caa
--- /dev/null
@@ -0,0 +1,29 @@
+! { dg-do run }
+! PR33162 INTRINSIC functions as ACTUAL argument
+! Test case adapted from PR by Jerry DeLisle <jvdelisle@gcc.gnu.org>
+module m
+implicit none
+contains
+  subroutine sub(a)
+    optional :: a
+    character(25) :: temp
+    interface
+      function a(x)
+        real(kind=8):: a
+        real(kind=8):: x
+        intent(in) :: x
+      end function a
+    end interface
+    if(present(a)) then
+      write(temp,'(f16.10)')a(4.0d0)
+      if (trim(temp) /= '   -0.6536436209') call abort
+    endif
+  end subroutine sub
+end module m
+
+use m
+implicit none
+intrinsic dcos
+call sub()
+call sub(dcos)
+end
diff --git a/gcc/testsuite/gfortran.dg/interface_20.f90 b/gcc/testsuite/gfortran.dg/interface_20.f90
new file mode 100644 (file)
index 0000000..2d7df47
--- /dev/null
@@ -0,0 +1,20 @@
+! { dg-do compile }
+! PR33162 INTRINSIC functions as ACTUAL argument
+! Test case adapted from PR by Jerry DeLisle <jvdelisle@gcc.gnu.org>
+module m
+implicit none
+contains
+  subroutine sub(a)
+    interface
+      function a()
+        real :: a
+      end function a
+    end interface
+    print *, a()
+  end subroutine sub
+end module m
+use m
+implicit none
+intrinsic cos
+call sub(cos) ! { dg-error "Type/rank mismatch in argument" }
+end
diff --git a/gcc/testsuite/gfortran.dg/interface_21.f90 b/gcc/testsuite/gfortran.dg/interface_21.f90
new file mode 100644 (file)
index 0000000..fea6507
--- /dev/null
@@ -0,0 +1,22 @@
+! { dg-do compile }
+! PR33162 INTRINSIC functions as ACTUAL argument
+! Test case adapted from PR by Jerry DeLisle <jvdelisle@gcc.gnu.org>
+module m
+implicit none
+contains
+  subroutine sub(a)
+    interface
+      function a(x)
+        real :: a, x
+        intent(in) :: x
+      end function a
+    end interface
+    print *, a(4.0)
+  end subroutine sub
+end module m
+
+use m
+implicit none
+EXTERNAL foo  ! implicit interface is undefined
+call sub(foo) ! { dg-error "Type/rank mismatch in argument" }
+end