[WebAssembly] Fix asan issue from https://reviews.llvm.org/D121349
[llvm-project.git] / flang / test / Evaluate / fold-substr.f90
blobc2b73c2affc91adf6d441f080cdc38f2241283b5
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 end module