fix pr/45972
[official-gcc.git] / gcc / testsuite / gfortran.dg / character_comparison_2.f90
blobd2736f874a61dc5e4b219516e2b115b38eeee178
1 ! { dg-do run }
2 ! { dg-options "-O -fdump-tree-original" }
3 program main
4 implicit none
5 character(len=4) :: c
6 integer :: n
7 integer :: i
8 integer :: k1, k2
9 common /foo/ i
11 n = 0
12 i = 0
13 k1 = 1
14 k2 = 3
15 c = 'abcd'
16 n = n + 1 ; if (c(1:2) == c(1:2)) call yes
17 n = n + 1 ; if (c(k1:k2) >= c(k1:k2)) call yes
18 n = n + 1 ; if (c(:2) <= c(1:2)) call yes
19 n = n + 1 ; if (c(k2:) .eq. c(k2:4)) call yes
20 n = n + 1 ; if (c(:) .ge. c) call yes
21 n = n + 1 ; if (c .le. c) call yes
22 if (c(1:2) /= c(1:2)) call abort
23 if (c(k1:k2) > c(k1:k2)) call abort
24 if (c(:2) < c(1:2)) call abort
25 if (c(:) .ne. c) call abort
26 if (c(:2) .gt. c(1:2)) call abort
27 if (c(1:2) .lt. c(:2)) call abort
28 if (n /= i) call abort
29 end program main
31 subroutine yes
32 implicit none
33 common /foo/ i
34 integer :: i
35 i = i + 1
36 end subroutine yes
38 ! { dg-final { scan-tree-dump-times "gfortran_compare_string" 0 "original" } }
39 ! { dg-final { cleanup-tree-dump "original" } }