PR c/29467
[official-gcc.git] / gcc / testsuite / gfortran.dg / single_char_string.f90
blob479456cfea86e404970791a1fa64f0880b7039bd
1 ! { dg-do run }
2 ! { dg-options "-fdump-tree-original" }
3 ! PR12456 - Optimize string(k:k) as single character.
5 Program pr12456
6 character a
7 character b
8 character (len=5) :: c
9 integer i
11 b = 'a'
12 a = b
13 if (a .ne. 'a') call abort()
14 if (a .ne. b) call abort()
15 c (3:3) = 'a'
16 if (c (3:3) .ne. b) call abort ()
17 if (c (3:3) .ne. 'a') call abort ()
18 if (LGT (a, c (3:3))) call abort ()
19 if (LGT (a, 'a')) call abort ()
21 i = 3
22 c (i:i) = 'a'
23 if (c (i:i) .ne. b) call abort ()
24 if (c (i:i) .ne. 'a') call abort ()
25 if (LGT (a, c (i:i))) call abort ()
27 if (a .gt. char (255)) call abort ()
28 end
30 ! There should not be _gfortran_compare_string and _gfortran_copy_string in
31 ! the dumped file.
33 ! { dg-final { scan-tree-dump-times "_gfortran_compare_string" 0 "original" } }
34 ! { dg-final { scan-tree-dump-times "_gfortran_copy_string" 0 "original" } }
36 ! { dg-final { cleanup-tree-dump "original" } }