OSDN Git Service

Really add:
authorburnus <burnus@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 14 Sep 2011 06:27:25 +0000 (06:27 +0000)
committerburnus <burnus@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 14 Sep 2011 06:27:25 +0000 (06:27 +0000)
2011-09-14  Tobias Burnus  <burnus@net-b.de>

        PR fortran/34547
        PR fortran/50375
        * gfortran.dg/null_5.f90: New.
        * gfortran.dg/null_6.f90: New.

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

gcc/testsuite/gfortran.dg/null_5.f90 [new file with mode: 0644]
gcc/testsuite/gfortran.dg/null_6.f90 [new file with mode: 0644]

diff --git a/gcc/testsuite/gfortran.dg/null_5.f90 b/gcc/testsuite/gfortran.dg/null_5.f90
new file mode 100644 (file)
index 0000000..886a6a1
--- /dev/null
@@ -0,0 +1,43 @@
+! { dg-do compile }
+! { dg-options "-std=f95" }
+!
+! PR fortran/34547
+! PR fortran/50375
+
+subroutine test_PR50375_1 ()
+  ! Contributed by Vittorio Zecca
+  interface gen1
+    subroutine s11 (pi)
+      integer, pointer :: pi
+    end subroutine
+    subroutine s12 (pr)
+      real, pointer :: pr
+    end subroutine
+  end interface
+  call gen1 (null ()) ! { dg-error "MOLD= required in NULL|There is no specific subroutine" }
+end subroutine test_PR50375_1
+
+subroutine test_PR50375_2 ()
+  interface gen2
+    subroutine s21 (pi)
+      integer, pointer :: pi
+    end subroutine
+    subroutine s22 (pr)
+      real, optional :: pr
+    end subroutine
+  end interface
+  call gen2 (null ()) ! OK in F95/F2003 (but not in F2008)
+end subroutine test_PR50375_2
+
+subroutine test_PR34547_1 ()
+  call proc (null ()) ! { dg-error "MOLD argument to NULL required" }
+end subroutine test_PR34547_1
+
+subroutine test_PR34547_2 ()
+  print *, null () ! { dg-error "in data transfer statement requires MOLD" }
+end subroutine test_PR34547_2
+
+subroutine test_PR34547_3 ()
+  integer, allocatable :: i(:)
+  print *, NULL(i) ! { dg-error "Fortran 2003: NULL intrinsic with allocatable MOLD" }
+end subroutine test_PR34547_3
diff --git a/gcc/testsuite/gfortran.dg/null_6.f90 b/gcc/testsuite/gfortran.dg/null_6.f90
new file mode 100644 (file)
index 0000000..dd517cf
--- /dev/null
@@ -0,0 +1,34 @@
+! { dg-do compile }
+! { dg-options "-std=f2008" }
+!
+! PR fortran/34547
+! PR fortran/50375
+
+subroutine test_PR50375_3 ()
+  interface gen3
+    subroutine s31 (pi)
+      integer, pointer :: pi
+    end subroutine
+    subroutine s32 (pr)
+      real, allocatable :: pr(:)
+    end subroutine
+  end interface
+  call gen3 (null ()) ! OK
+end subroutine test_PR50375_3
+
+subroutine test_PR50375_2 ()
+  interface gen2
+    subroutine s21 (pi)
+      integer, pointer :: pi
+    end subroutine
+    subroutine s22 (pr)
+      real, optional :: pr
+    end subroutine
+  end interface
+  call gen2 (null ()) ! { dg-error "MOLD= required in NULL|There is no specific subroutine" }
+end subroutine test_PR50375_2
+
+subroutine test_PR34547_3 ()
+  integer, allocatable :: i(:)
+  print *, NULL(i)
+end subroutine test_PR34547_3