summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/string_3.f90
blob: 7daf8d31ae665285594f99314ce182f0aaf664fe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
! { dg-do compile }
!
subroutine foo(i)
  implicit none
  integer, intent(in) :: i
  character(len=i) :: s

  s = ''
  print *, s(1:2_8**32_8+3_8) ! { dg-error "too large" }
  print *, s(2_8**32_8+3_8:2_8**32_8+4_8) ! { dg-error "too large" }
  print *, len(s(1:2_8**32_8+3_8)) ! { dg-error "too large" }
  print *, len(s(2_8**32_8+3_8:2_8**32_8+4_8)) ! { dg-error "too large" }

  print *, s(2_8**32_8+3_8:1)
  print *, s(2_8**32_8+4_8:2_8**32_8+3_8)
  print *, len(s(2_8**32_8+3_8:1))
  print *, len(s(2_8**32_8+4_8:2_8**32_8+3_8))

end subroutine