[flang] Accept polymorphic component element in storage_size
[llvm-project.git] / flang / test / Evaluate / fold-ibits.f90
blobb49fce9f7af96dd76d7afabdfa21b3feb1896f4e
1 ! RUN: %python %S/test_folding.py %s %flang_fc1
2 ! Tests folding of IBITS exhaustively over POS/LEN ranges
3 module m1
4 implicit integer(a-z)
5 integer, parameter :: res1(*) = [((ibits(not(0),pos,len),len=0,31-pos),pos=0,31)]
6 integer, parameter :: expect1(*) = [((maskr(len),len=0,31-pos),pos=0,31)]
7 logical, parameter :: test1 = all(res1 == expect1)
8 logical, parameter :: test2 = all([((ibits(0,pos,len),len=0,31-pos),pos=0,31)] == 0)
9 integer, parameter :: mess = z'a5a55a5a'
10 integer, parameter :: res3(*) = [((ibits(mess,pos,len),len=0,31-pos),pos=0,31)]
11 integer, parameter :: expect3(*) = [((iand(shiftr(mess,pos),maskr(len)),len=0,31-pos),pos=0,31)]
12 logical, parameter :: test3 = all(res3 == expect3)
13 end module