[flang] Accept polymorphic component element in storage_size
[llvm-project.git] / flang / test / Evaluate / fold-substr.f90
blobb36887e7f4dfd2b3fe5edc78c3c3be5b8369d335
1 ! RUN: %python %S/test_folding.py %s %flang_fc1
2 ! Test folding of substrings
3 module m
4 logical, parameter :: test_01a = "abc"(1:3) == "abc"
5 logical, parameter :: test_01b = len("abc"(1:3)) == 3
6 logical, parameter :: test_02a = "abc"(-1:-2) == ""
7 logical, parameter :: test_02b = len("abc"(-1:-2)) == 0
8 logical, parameter :: test_03a = "abc"(9999:4) == ""
9 logical, parameter :: test_03b = len("abc"(9999:4)) == 0
10 character(4), parameter :: ca(3) = ["abcd", "efgh", "ijkl"]
11 logical, parameter :: test_04a = ca(2)(2:4) == "fgh"
12 logical, parameter :: test_04b = len(ca(2)(2:4)) == 3
13 logical, parameter :: test_05a = all(ca(:)(2:4) == ["bcd", "fgh", "jkl"])
14 logical, parameter :: test_05b = len(ca(:)(2:4)) == 3
15 logical, parameter :: test_06a = ca(1)(1:2)//ca(2)(2:3)//ca(3)(3:4) == "abfgkl"
16 logical, parameter :: test_06b = len(ca(1)(1:2)//ca(2)(2:3)//ca(3)(3:4)) == 6
17 logical, parameter :: test_07a = ca(1)(:2) == "ab"
18 logical, parameter :: test_07b = ca(1)(3:) == "cd"
19 logical, parameter :: test_07c = ca(1)(:-1) == ""
20 logical, parameter :: test_07d = ca(1)(5:) == ""
21 logical, parameter :: test_07e = ca(1)(:) == "abcd"
22 end module