2 ! { dg-options "-fdump-tree-original" }
3 ! Test that all string length calculations are
6 character (len
=999) :: c
7 character (len
=5) :: unit
9 read (unit
=unit
,fmt
='(I5)') i
! Hide from optimizers
12 if (len(c( 3 : 5 )) /= 3) call abort
! Case 1
13 if (len(c( i
*(i
+1) : (i
+1)*i
+ 2 )) /= 3) call abort
! Case 2
14 if (len(c( i
*(i
+1) : 2 + (i
+1)*i
)) /= 3) call abort
! Case 3
15 if (len(c( i
*(i
+1) + 2 : (i
+1)*i
+ 3 )) /= 2) call abort
! Case 4
16 if (len(c( 2 + i
*(i
+1) : (i
+1)*i
+ 3 )) /= 2) call abort
! Case 5
17 if (len(c( i
*(i
+1) + 2 : 3 + (i
+1)*i
)) /= 2) call abort
! Case 6
18 if (len(c( 2 + i
*(i
+1) : 3 + (i
+1)*i
)) /= 2) call abort
! Case 7
19 if (len(c( i
*(i
+1) - 1 : (i
+1)*i
+ 1 )) /= 3) call abort
! Case 8
20 if (len(c( i
*(i
+1) - 1 : 1 + (i
+1)*i
)) /= 3) call abort
! Case 9
21 if (len(c( i
*(i
+1) : (i
+1)*i
-(-1))) /= 2) call abort
! Case 10
22 if (len(c( i
*(i
+1) +(-2): (i
+1)*i
- 1 )) /= 2) call abort
! Case 11
23 if (len(c( i
*(i
+1) + 2 : (i
+1)*i
-(-4))) /= 3) call abort
! Case 12
24 if (len(c( i
*(i
+1) - 3 : (i
+1)*i
- 1 )) /= 3) call abort
! Case 13
25 if (len(c(13 - i
*(i
+1) :15 - (i
+1)*i
)) /= 3) call abort
! Case 14
26 if (len(c( i
*(i
+1) +(-1): (i
+1)*i
)) /= 2) call abort
! Case 15
27 if (len(c(-1 + i
*(i
+1) : (i
+1)*i
)) /= 2) call abort
! Case 16
28 if (len(c( i
*(i
+1) - 2 : (i
+1)*i
)) /= 3) call abort
! Case 17
29 if (len(c( (i
-2)*(i
-3) : (i
-3)*(i
-2) )) /= 1) call abort
! Case 18
31 ! { dg-final { scan-tree-dump-times "_abort" 0 "original" } }