Break circular dependency between FIR dialect and utilities
[llvm-project.git] / flang / test / Semantics / call07.f90
blob673648979ab554c72720498465d5d5205412a8c5
1 ! RUN: %python %S/test_errors.py %s %flang_fc1
2 ! Test 15.5.2.7 constraints and restrictions for POINTER dummy arguments.
4 module m
5 real :: coarray(10)[*]
6 contains
8 subroutine s01(p)
9 real, pointer, contiguous, intent(in) :: p(:)
10 end subroutine
11 subroutine s02(p)
12 real, pointer :: p(:)
13 end subroutine
14 subroutine s03(p)
15 real, pointer, intent(in) :: p(:)
16 end subroutine
17 subroutine s04(p)
18 real, pointer :: p
19 end subroutine
21 subroutine test
22 !ERROR: CONTIGUOUS POINTER must be an array
23 real, pointer, contiguous :: a01 ! C830
24 real, pointer :: a02(:)
25 real, target :: a03(10)
26 real :: a04(10) ! not TARGET
27 call s01(a03) ! ok
28 !ERROR: Actual argument associated with CONTIGUOUS POINTER dummy argument 'p=' must be simply contiguous
29 call s01(a02)
30 !ERROR: Actual argument associated with CONTIGUOUS POINTER dummy argument 'p=' must be simply contiguous
31 call s01(a03(::2))
32 call s02(a02) ! ok
33 call s03(a03) ! ok
34 !ERROR: Actual argument associated with POINTER dummy argument 'p=' must also be POINTER unless INTENT(IN)
35 call s02(a03)
36 !ERROR: Actual argument associated with POINTER dummy argument 'p=' must also be POINTER unless INTENT(IN)
37 call s04(a02(1))
38 !ERROR: An array section with a vector subscript may not be a pointer target
39 call s03(a03([1,2,4]))
40 !ERROR: A coindexed object may not be a pointer target
41 call s03(coarray(:)[1])
42 !ERROR: Target associated with dummy argument 'p=' must be a designator or a call to a pointer-valued function
43 call s03([1.])
44 !ERROR: In assignment to object dummy argument 'p=', the target 'a04' is not an object with POINTER or TARGET attributes
45 call s03(a04)
46 end subroutine
47 end module