nvptx, libgfortran: Switch out of "minimal" mode
[official-gcc.git] / gcc / testsuite / gfortran.dg / pointer_intent_7.f90
blob5387ace8c1977e8da7b50abfe5bc6b8edaa4b4ca
1 ! { dg-do compile }
3 ! PR fortran/
5 ! Contributed by Neil Carlson
7 ! Check whether passing an intent(in) pointer
8 ! to an intent(inout) nonpointer is allowed
10 module modA
11 type :: typeA
12 integer, pointer :: ptr
13 end type
14 contains
15 subroutine foo (a,b,c)
16 type(typeA), intent(in) :: a
17 type(typeA), intent(in) , pointer :: b
18 class(typeA), intent(in) , pointer :: c
20 call bar (a%ptr)
21 call bar2 (b)
22 call bar3 (b)
23 call bar2 (c)
24 call bar3 (c)
25 call bar2p (b) ! { dg-error "INTENT\\(IN\\) in pointer association context \\(actual argument to INTENT = OUT/INOUT" }
26 call bar3p (b) ! { dg-error "Actual argument to .n. at \\(1\\) must be polymorphic" }
27 call bar2p (c) ! { dg-error "INTENT\\(IN\\) in pointer association context \\(actual argument to INTENT = OUT/INOUT" }
28 call bar3p (c) ! { dg-error "INTENT\\(IN\\) in pointer association context \\(actual argument to INTENT = OUT/INOUT" }
29 end subroutine
30 subroutine bar (n)
31 integer, intent(inout) :: n
32 end subroutine
33 subroutine bar2 (n)
34 type(typeA), intent(inout) :: n
35 end subroutine
36 subroutine bar3 (n)
37 class(typeA), intent(inout) :: n
38 end subroutine
39 subroutine bar2p (n)
40 type(typeA), intent(inout), pointer :: n
41 end subroutine
42 subroutine bar3p (n)
43 class(typeA), intent(inout), pointer :: n
44 end subroutine
45 end module