2011-05-23 Tom de Vries <tom@codesourcery.com>
[official-gcc.git] / gcc / testsuite / gfortran.dg / string_compare_3.f90
blob46a11d3f55a70cce2e72755394c04ba2b121793f
1 ! { dg-do run }
3 ! PR fortran/37099
4 ! Check for correct results when comparing array-section-substrings.
6 ! This is the test from comment #1 of the PR.
7 ! Contributed by Dominique d'Humieres <dominiq@lps.ens.fr>
9 integer, parameter :: n = 10
10 integer, parameter :: ilst(n) = (/(i,i=1,n)/)
11 character(*), parameter :: c0lst(n) = (/(char(96+i),i=1,n)/)
12 character(*), parameter :: c1lst(n) = (/(char(96+i)//'b',i=1,n)/)
13 logical :: tmp(n)
14 i = 5
15 print *, ilst(:) == i
16 print *, c0lst(:)(1:1) == char(96+i)
17 tmp = c1lst(:)(1:1) == char(96+i)
18 print *, tmp
19 print *, c1lst(:)(1:1) == 'e'
20 if (any(tmp .neqv. (c0lst(:)(1:1) == char(96+i)))) call abort()
21 end