aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/index_2.f90
blob: d0e99bd99d4b1612939d3c7e610a49932349f4d6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
! { dg-do run }
! { dg-options "-fdump-tree-original" }
! PR fortran/36462
!
  implicit none
  character(len=10,kind=1) string1
  character(len=10,kind=4) string4
  string1 = 'ABCDEEDCBA'
  string4 = 'ABCDEEDCBA'

  if(index(string1,1_'A') /= 1) STOP 1
  if(index(string4,4_'A') /= 1) STOP 2
  if(index(string1,1_'A',kind=4) /= 1_4) STOP 3
  if(index(string4,4_'A',kind=4) /= 1_4) STOP 4
  if(index(string1,1_'A',kind=1) /= 1_1) STOP 5
  if(index(string4,4_'A',kind=1) /= 1_1) STOP 6

  if(index(string1,1_'A',back=.true.) /= 10) STOP 7
  if(index(string4,4_'A',back=.true.) /= 10) STOP 8
  if(index(string1,1_'A',kind=4,back=.true.) /= 10_4) STOP 9
  if(index(string4,4_'A',kind=4,back=.true.) /= 10_4) STOP 10
  if(index(string1,1_'A',kind=1,back=.true.) /= 10_1) STOP 11
  if(index(string4,4_'A',kind=1,back=.true.) /= 10_1) STOP 12

  if(index(string1,1_'A',back=.false.) /= 1) STOP 13
  if(index(string4,4_'A',back=.false.) /= 1) STOP 14
  if(index(string1,1_'A',kind=4,back=.false.) /= 1_4) STOP 15
  if(index(string4,4_'A',kind=4,back=.false.) /= 1_4) STOP 16
  if(index(string1,1_'A',kind=1,back=.false.) /= 1_1) STOP 17
  if(index(string4,4_'A',kind=1,back=.false.) /= 1_1) STOP 18

  if(scan(string1,1_'A') /= 1) STOP 19
  if(scan(string4,4_'A') /= 1) STOP 20
  if(scan(string1,1_'A',kind=4) /= 1_4) STOP 21
  if(scan(string4,4_'A',kind=4) /= 1_4) STOP 22
  if(scan(string1,1_'A',kind=1) /= 1_1) STOP 23
  if(scan(string4,4_'A',kind=1) /= 1_1) STOP 24

  if(scan(string1,1_'A',back=.true.) /= 10) STOP 25
  if(scan(string4,4_'A',back=.true.) /= 10) STOP 26
  if(scan(string1,1_'A',kind=4,back=.true.) /= 10_4) STOP 27
  if(scan(string4,4_'A',kind=4,back=.true.) /= 10_4) STOP 28
  if(scan(string1,1_'A',kind=1,back=.true.) /= 10_1) STOP 29
  if(scan(string4,4_'A',kind=1,back=.true.) /= 10_1) STOP 30

  if(scan(string1,1_'A',back=.false.) /= 1) STOP 31
  if(scan(string4,4_'A',back=.false.) /= 1) STOP 32
  if(scan(string1,1_'A',kind=4,back=.false.) /= 1_4) STOP 33
  if(scan(string4,4_'A',kind=4,back=.false.) /= 1_4) STOP 34
  if(scan(string1,1_'A',kind=1,back=.false.) /= 1_1) STOP 35
  if(scan(string4,4_'A',kind=1,back=.false.) /= 1_1) STOP 36
  end

! { dg-final { scan-tree-dump-times "if ..integer.kind=1.. _gfortran_string_index" 6 "original" } }
! { dg-final { scan-tree-dump-times "if ..integer.kind=1.. _gfortran_string_scan" 6 "original" } }