ieee_9.f90: XFAIL on arm*-*-gnueabi[hf].
[official-gcc.git] / gcc / testsuite / gfortran.dg / elemental_function_2.f90
blob7836ce8f4df70c354671bd29f3971c675c703456
1 ! { dg-do compile }
3 ! Test the fix for PR87239 in which the call to the elemental function
4 ! 'gettwo' was being added before the scalarization loop in the assignment.
5 ! Since the result temporary was being declared in the loop body, this
6 ! drove the gimplifier crazy. It is sufficient to compile this testcase
7 ! since it used to ICE.
9 ! Contributed by Juergen Reuter <juergen.reuter@desy.de>
11 module test
12 implicit none
13 contains
15 elemental function gettwo( s ) result( res )
16 character(*), intent(in) :: s
17 character(len(s)) :: res
19 res = s( 1 : 2 )
20 endfunction gettwo
22 endmodule test
24 program main
25 use test
26 implicit none
27 character(10) :: inp( 5 )
28 integer :: i
30 ! character(10), allocatable :: out(:) ! this works
31 character(:), allocatable :: out(:) ! this was stuffed
33 inp = [ 'aaa', 'bbb', 'ccc', 'ddd', 'eee' ]
35 out = gettwo( inp )
37 do i = 1, size (out, 1)
38 if (trim (out(i)) .ne. inp(i)(1:2)) stop 1
39 end do
40 endprogram main