PR c/29467
[official-gcc.git] / gcc / testsuite / gfortran.dg / scan_2.f90
blob1e68130c3f5883763a25a48164b19c4913ffd228
1 ! { dg-do compile }
2 ! { dg-options "-fdump-tree-original" }
4 ! PR fortran/54608
6 ! Contributed by James Van Buskirk
8 module m1
9 implicit none
10 contains
11 subroutine s1(A)
12 logical A
13 integer iscan, iverify
14 character(7), parameter :: tf(2) = ['.FALSE.','.TRUE. ']
16 iscan = scan('AA','A',back=A)
17 iverify = verify('xx','A',back=A)
18 if (iscan /= 2 .or. iverify /= 2) call abort ()
19 print *, iverify, iscan
20 ! write(*,'(a)') 'SCAN test: A = '//trim(tf(iscan)) ! should print true
21 ! write(*,'(a)') 'VERIFY test: A = '//trim(tf(iverify)) ! should print true
22 end subroutine s1
23 end module m1
25 program p1
26 use m1
27 implicit none
28 logical B
30 call s1(.TRUE.)
31 end program p1
33 ! { dg-final { scan-tree-dump-times "iscan = _gfortran_string_scan \\(2," 1 "original" } }
34 ! { dg-final { scan-tree-dump-times "iverify = _gfortran_string_verify \\(2," 1 "original" } }
35 ! { dg-final { cleanup-tree-dump "original" } }