Debian Codegraph @

gcc/testsuite/gfortran.dg/ptr_func_assign_4.f08

raw
1 ! { dg-do compile }
2 !
3 ! Tests correction to implementation of pointer function assignments.
4 !
5 ! Contributed by Mikael Morin <[email protected]>
6 !
7 program p
8 integer, target :: a(3) = 2
9 integer :: b(3, 3) = 1
10 integer :: c
11
12 c = 3
13 func (b(2, 2)) = b ! { dg-error "Incompatible ranks 1 and 2 in assignment" }
14 func (c) = b ! { dg-error "Incompatible ranks 1 and 2 in assignment" }
15
16 contains
17 function func(arg) result(r)
18 integer, pointer :: r(:)
19 integer :: arg
20
21 if (arg == 1) then
22 r => a
23 else
24 r => null()
25 end if
26 end function func
27 end program p