3 ! Test the fix for PR77703, in which calls of the pointer function
4 ! caused an ICE in 'gfc_trans_auto_character_variable'.
6 ! Contributed by Gerhard Steinmetz <gerhard.steinmetz.fortran@t-online.de>
11 integer, parameter, public :: n = 2
12 integer, parameter :: ell = 6
14 character(len=n*ell), target, public :: s
18 function t( idx ) result( substr )
19 integer, intent(in) :: idx
20 character(len=ell), pointer :: substr
22 if ( (idx < 0).or.(idx > n) ) then
25 substr => s((idx-1)*ell+1:idx*ell)
36 ! Then perform operations involving 't'
37 if (t(1) .ne. "123456") stop 1
38 if (t(2) .ne. "789012") stop 2
40 ! Do the pointer function assignments
42 if (s .ne. "Hello 789012") Stop 3
44 if (s .ne. "Hello World!") Stop 4