1! { dg-do run } 2! 3! PR fortran/59906 4! 5! Contributed by H Anlauf <anlauf@gmx.de> 6! 7! Failed generate character scalar for scalarized loop for elemantal call. 8! 9program x 10 implicit none 11 call y('bbb') 12contains 13 14 subroutine y(str) 15 character(len=*), intent(in) :: str 16 character(len=len_trim(str)) :: str_aux 17 character(len=3) :: str3 = 'abc' 18 19 str_aux = str 20 21 ! Compiled but did not give correct result 22 if (any (str_cmp((/'aaa','bbb'/), str) .neqv. [.FALSE.,.TRUE.])) STOP 1 23 24 ! Did not compile 25 if (any (str_cmp((/'bbb', 'aaa'/), str_aux) .neqv. [.TRUE.,.FALSE.])) STOP 2 26 27 ! Verify patch 28 if (any (str_cmp((/'bbb', 'aaa'/), str3) .neqv. [.FALSE.,.FALSE.])) STOP 3 29 if (any (str_cmp((/'bbb', 'aaa'/), 'aaa') .neqv. [.FALSE.,.TRUE.])) STOP 4 30 31 end subroutine y 32 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 38 39end program x 40