PR inline-asm/84742
[official-gcc.git] / gcc / testsuite / gfortran.dg / select_char_1.f90
blob1b79aac1129c96e52bc1a8805508ec1f4143bf2b
1 ! { dg-do run }
2 integer function char_select (s)
3 character(len=*), intent(in) :: s
5 select case(s)
6 case ("foo")
7 char_select = 1
8 case ("bar", "gee")
9 char_select = 2
10 case ("111", "999")
11 char_select = 3
12 case ("1024", "1900")
13 char_select = 4
14 case ("12", "17890")
15 char_select = 5
16 case default
17 char_select = -1
18 end select
19 end function char_select
21 integer function char_select2 (s)
22 character(len=*), intent(in) :: s
24 char_select2 = -1
25 select case(s)
26 case ("foo")
27 char_select2 = 1
28 case ("bar", "gee")
29 char_select2 = 2
30 case ("111", "999")
31 char_select2 = 3
32 case ("1024", "1900")
33 char_select2 = 4
34 case ("12", "17890")
35 char_select2 = 5
36 end select
37 end function char_select2
40 program test
41 interface
42 integer function char_select (s)
43 character(len=*), intent(in) :: s
44 end function char_select
45 integer function char_select2 (s)
46 character(len=*), intent(in) :: s
47 end function char_select2
48 end interface
50 if (char_select("foo") /= 1) STOP 1
51 if (char_select("foo ") /= 1) STOP 2
52 if (char_select("foo2 ") /= -1) STOP 3
53 if (char_select("bar") /= 2) STOP 4
54 if (char_select("gee") /= 2) STOP 5
55 if (char_select("000") /= -1) STOP 6
56 if (char_select("101") /= -1) STOP 7
57 if (char_select("109") /= -1) STOP 8
58 if (char_select("111") /= 3) STOP 9
59 if (char_select("254") /= -1) STOP 10
60 if (char_select("999") /= 3) STOP 11
61 if (char_select("9989") /= -1) STOP 12
62 if (char_select("1882") /= -1) STOP 13
64 if (char_select2("foo") /= 1) STOP 14
65 if (char_select2("foo ") /= 1) STOP 15
66 if (char_select2("foo2 ") /= -1) STOP 16
67 if (char_select2("bar") /= 2) STOP 17
68 if (char_select2("gee") /= 2) STOP 18
69 if (char_select2("000") /= -1) STOP 19
70 if (char_select2("101") /= -1) STOP 20
71 if (char_select2("109") /= -1) STOP 21
72 if (char_select2("111") /= 3) STOP 22
73 if (char_select2("254") /= -1) STOP 23
74 if (char_select2("999") /= 3) STOP 24
75 if (char_select2("9989") /= -1) STOP 25
76 if (char_select2("1882") /= -1) STOP 26
77 end program test