2017-12-08 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / gfortran.dg / character_comparison_2.f90
blobd4c38e82784c7d4654d066130edec4483821355f
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" } }