1! RUN: %python %S/test_errors.py %s %flang_fc1
2! C1030 - assignment of pointers to intrinsic procedures
3! C1515 - interface definition for procedure pointers
4! C1519 - initialization of pointers to intrinsic procedures
5program main
6  intrinsic :: cos ! a specific & generic intrinsic name
7  intrinsic :: alog10 ! a specific intrinsic name, not generic
8  intrinsic :: null ! a weird special case
9  intrinsic :: bessel_j0 ! generic intrinsic, not specific
10  intrinsic :: amin0
11  intrinsic :: mod
12  intrinsic :: llt
13  !ERROR: 'haltandcatchfire' is not a known intrinsic procedure
14  intrinsic :: haltandcatchfire
15
16  abstract interface
17     logical function chrcmp(a,b)
18       character(*), intent(in) :: a
19       character(*), intent(in) :: b
20     end function chrcmp
21  end interface
22
23  procedure(sin), pointer :: p => cos
24  !ERROR: Intrinsic procedure 'amin0' is not an unrestricted specific intrinsic permitted for use as the definition of the interface to procedure pointer 'q'
25  procedure(amin0), pointer :: q
26  !ERROR: Intrinsic procedure 'bessel_j0' is not an unrestricted specific intrinsic permitted for use as the definition of the interface to procedure pointer 'r'
27  procedure(bessel_j0), pointer :: r
28  !ERROR: Intrinsic procedure 'llt' is not an unrestricted specific intrinsic permitted for use as the initializer for procedure pointer 's'
29  procedure(chrcmp), pointer :: s => llt
30  !ERROR: Intrinsic procedure 'bessel_j0' is not an unrestricted specific intrinsic permitted for use as the initializer for procedure pointer 't'
31  procedure(cos), pointer :: t => bessel_j0
32  procedure(chrcmp), pointer :: u
33  p => alog ! valid use of an unrestricted specific intrinsic
34  p => alog10 ! ditto, but already declared intrinsic
35  p => cos ! ditto, but also generic
36  p => tan ! a generic & an unrestricted specific, not already declared
37  !ERROR: Procedure pointer 'p' associated with incompatible procedure designator 'mod': function results have incompatible types: REAL(4) vs INTEGER(4)
38  p => mod
39  !ERROR: Procedure pointer 'p' associated with incompatible procedure designator 'index': function results have incompatible types: REAL(4) vs INTEGER(4)
40  p => index
41  !ERROR: 'bessel_j0' is not an unrestricted specific intrinsic procedure
42  p => bessel_j0
43  !ERROR: 'llt' is not an unrestricted specific intrinsic procedure
44  u => llt
45end program main
46