2017-12-08 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / gfortran.dg / elemental_subroutine_9.f90
blob8f574bf595e82d6787239914bc886711a530200a
1 ! { dg-do run }
3 ! PR fortran/59906
5 ! Contributed by H Anlauf <anlauf@gmx.de>
7 ! Failed generate character scalar for scalarized loop for elemantal call.
9 program x
10 implicit none
11 call y('bbb')
12 contains
14 subroutine y(str)
15 character(len=*), intent(in) :: str
16 character(len=len_trim(str)) :: str_aux
17 character(len=3) :: str3 = 'abc'
19 str_aux = str
21 ! Compiled but did not give correct result
22 if (any (str_cmp((/'aaa','bbb'/), str) .neqv. [.FALSE.,.TRUE.])) call abort
24 ! Did not compile
25 if (any (str_cmp((/'bbb', 'aaa'/), str_aux) .neqv. [.TRUE.,.FALSE.])) call abort
27 ! Verify patch
28 if (any (str_cmp((/'bbb', 'aaa'/), str3) .neqv. [.FALSE.,.FALSE.])) call abort
29 if (any (str_cmp((/'bbb', 'aaa'/), 'aaa') .neqv. [.FALSE.,.TRUE.])) call abort
31 end subroutine y
33 elemental logical function str_cmp(str1, str2)
34 character(len=*), intent(in) :: str1
35 character(len=*), intent(in) :: str2
36 str_cmp = (str1 == str2)
37 end function str_cmp
39 end program x