aboutsummaryrefslogtreecommitdiff
path: root/flang/test/Semantics/zero_len_char_array.f90
blob: 3998cd32c818cf2c3675148a8ebfb2f70142388d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
! RUN: %flang_fc1 -fsyntax-only %s 2>&1 | FileCheck --allow-empty %s
! CHECK-NOT: error:
! Test that zero-length character substrings with lbound>ubounds indices
! do not produce spurious errors when the character array is zero length.
program flang_t7052
  implicit none
  character*(*), parameter :: param_char = ""
  character*(0)            :: zero_len_char

  if ( param_char(init(5):init(3)) > zero_len_char(1:-2) ) then
    print *,"Test failed"
  endif

  if ( param_char(init(5):init(3)) > zero_len_char(10:2) ) then
    print *,"Test failed"
  endif

  if ( param_char(init(5):init(3)) > zero_len_char(init(10):2) ) then
    print *,"Test failed"
  endif

  if ( param_char(init(5):init(3)) > zero_len_char(init(10):-2) ) then
    print *,"Test failed"
  endif

  if ( param_char(init(5):init(3)) > zero_len_char(2:init(10)) ) then
    print *,"Test failed"
  endif

contains

  integer function init(i)
    integer, intent(in) :: i
    init=i
  end

end program