2014-07-12 Paul Thomas <pault@gcc.gnu.org>
[official-gcc.git] / gcc / testsuite / gfortran.dg / substr_5.f90
blobfb409ead9522a0711a35437947d35b5df063f0f9
1 ! { dg-do run }
3 character(*), parameter :: chrs = '-+.0123456789eEdD'
4 character(*), parameter :: expr = '-+.0123456789eEdD'
5 integer :: i
7 if (index(chrs(:), expr) /= 1) call abort
8 if (index(chrs(14:), expr) /= 0) call abort
9 if (index(chrs(:12), expr) /= 0) call abort
10 if (index(chrs, expr(:)) /= 1) call abort
11 if (index(chrs, expr(1:)) /= 1) call abort
12 if (index(chrs, expr(:1)) /= 1) call abort
14 if (foo(expr) /= 1) call abort
15 if (foo(expr) /= 1) call abort
16 if (foo(expr) /= 1) call abort
17 if (foo(expr(:)) /= 1) call abort
18 if (foo(expr(1:)) /= 1) call abort
19 if (foo(expr(:1)) /= 1) call abort
21 call bar(expr)
23 contains
24 subroutine bar(expr)
25 character(*), intent(in) :: expr
26 character(*), parameter :: chrs = '-+.0123456789eEdD'
27 integer :: foo
29 if (index(chrs(:), expr) /= 1) call abort
30 if (index(chrs(14:), expr) /= 0) call abort
31 if (index(chrs(:12), expr) /= 0) call abort
32 if (index(chrs, expr(:)) /= 1) call abort
33 if (index(chrs, expr(1:)) /= 1) call abort
34 if (index(chrs, expr(:1)) /= 1) call abort
35 end subroutine bar
37 integer function foo(expr)
38 character(*), intent(in) :: expr
39 character(*), parameter :: chrs = '-+.0123456789eEdD'
41 foo = index(chrs, expr)
42 end function foo
44 end