PR inline-asm/84742
[official-gcc.git] / gcc / testsuite / gfortran.dg / ptr_func_assign_4.f08
blob46ef2ac556689ef5cb45af80da3fb0557f55fec9
1 ! { dg-do compile }
3 ! Tests correction to implementation of pointer function assignments.
5 ! Contributed by Mikael Morin  <mikael.morin@sfr.fr>
7 program p
8   integer, target :: a(3) = 2
9   integer :: b(3, 3) = 1
10   integer :: c
12   c = 3
13   func (b(2, 2)) = b ! { dg-error "Different ranks" }
14   func (c) = b       ! { dg-error "Different ranks" }
16 contains
17   function func(arg) result(r)
18     integer, pointer :: r(:)
19     integer :: arg
21     if (arg == 1) then
22       r => a
23     else
24       r => null()
25     end if
26   end function func
27 end program p