PR target/83368
[official-gcc.git] / gcc / testsuite / gfortran.dg / null_5.f90
blob50b41c3e8bf63ac19eab366e7f869b2d3c0d6749
1 ! { dg-do compile }
2 ! { dg-options "-std=f95" }
4 ! PR fortran/34547
5 ! PR fortran/50375
7 subroutine test_PR50375_1 ()
8 ! Contributed by Vittorio Zecca
9 interface gen1
10 subroutine s11 (pi)
11 integer, pointer :: pi
12 end subroutine
13 subroutine s12 (pr)
14 real, pointer :: pr
15 end subroutine
16 end interface
17 call gen1 (null ()) ! { dg-error "MOLD= required in NULL|There is no specific subroutine" }
18 end subroutine test_PR50375_1
20 subroutine test_PR50375_2 ()
21 interface gen2
22 subroutine s21 (pi)
23 integer, pointer :: pi
24 end subroutine
25 subroutine s22 (pr)
26 real, optional :: pr
27 end subroutine
28 end interface
29 call gen2 (null ()) ! OK in F95/F2003 (but not in F2008)
30 end subroutine test_PR50375_2
32 subroutine test_PR34547_1 ()
33 call proc (null ()) ! { dg-error "MOLD argument to NULL required" }
34 end subroutine test_PR34547_1
36 subroutine test_PR34547_2 ()
37 print *, null () ! { dg-error "Invalid context" }
38 end subroutine test_PR34547_2
40 subroutine test_PR34547_3 ()
41 integer, allocatable :: i(:)
42 print *, NULL(i) ! { dg-error "Fortran 2003: NULL intrinsic with allocatable MOLD" }
43 end subroutine test_PR34547_3