c: Fix up pointer types to may_alias structures [PR114493]
[official-gcc.git] / gcc / testsuite / gfortran.dg / pr113956.f90
blob229e891f847b36ec82c5bad4520a194a48e37eb6
1 ! { dg-do run }
2 ! Test the fix for PR113956
3 ! Contributed by David Binderman <dcb314@hotmail.com>
4 module m
5 contains
6 subroutine test_array_char(p, x)
7 character(*), target :: x(:)
8 character(:), pointer :: p(:)
9 p => x ! ICE
10 end subroutine
11 end module
13 use m
14 character(:), allocatable, target :: chr(:)
15 character(:), pointer :: p(:)
16 chr = ["ab","cd"]
17 call test_array_char (p, chr)
18 if (loc (chr) .ne. loc (p)) stop 1
19 if (len (p) .ne. 2) stop 2
20 if (any (p .ne. chr)) stop 3
21 end