Debian Codegraph @

gcc/testsuite/gfortran.dg/mapping_3.f90

raw
1 ! { dg-do run }
2 ! Tests the fix for PR33888, in which the character length of
3 ! the elemental function myfunc was not being calculated before
4 ! the temporary for the array result was allocated.
5 !
6 ! Contributed by Walter Spector <[email protected]>
7 !
8 program ftn95bug
9 implicit none
10
11 character(8) :: indata(4) = &
12 (/ '12344321', '98766789', 'abcdefgh', 'ABCDEFGH' /)
13
14 call process (myfunc (indata)) ! <- This caused a gfortran ICE !
15
16 contains
17
18 elemental function myfunc (s)
19 character(*), intent(in) :: s
20 character(len (s)) :: myfunc
21
22 myfunc = s
23
24 end function
25
26 subroutine process (strings)
27 character(*), intent(in) :: strings(:)
28
29 if (any (strings .ne. indata)) STOP 1
30
31 end subroutine
32
33 end program