1! { dg-do compile }
2! { dg-options "-std=f95" }
3!
4! PR fortran/34547
5! PR fortran/50375
6
7subroutine 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" }
18end subroutine test_PR50375_1
19
20subroutine 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)
30end subroutine test_PR50375_2
31
32subroutine test_PR34547_1 ()
33  call proc (null ()) ! { dg-error "MOLD argument to NULL required" }
34end subroutine test_PR34547_1
35
36subroutine test_PR34547_2 ()
37  print *, null () ! { dg-error "Invalid context" }
38end subroutine test_PR34547_2
39
40subroutine test_PR34547_3 ()
41  integer, allocatable :: i(:)
42  print *, NULL(i) ! { dg-error "Fortran 2003: NULL intrinsic with allocatable MOLD" }
43end subroutine test_PR34547_3
44