[LoopReroll] Add an extra defensive check to avoid SCEV assertion.
[llvm-project.git] / flang / test / Semantics / modfile25.f90
blobf17fd22d78d2d7738802b669ca680aec95de3f13
1 ! RUN: %S/test_modfile.sh %s %t %flang_fc1
2 ! REQUIRES: shell
3 ! Test compile-time analysis of shapes.
5 module m1
6 integer(8), parameter :: a0s(*) = shape(3.14159)
7 real :: a1(5,5,5)
8 integer(8), parameter :: a1s(*) = shape(a1)
9 integer(8), parameter :: a1ss(*) = shape(a1s)
10 integer(8), parameter :: a1sss(*) = shape(a1ss)
11 integer(8), parameter :: a1rs(*) = [rank(a1),rank(a1s),rank(a1ss),rank(a1sss)]
12 integer(8), parameter :: a1n(*) = [size(a1),size(a1,1),size(a1,2)]
13 integer(8), parameter :: a1sn(*) = [size(a1s),size(a1ss),size(a1sss)]
14 integer(8), parameter :: ac1s(*) = shape([1])
15 integer(8), parameter :: ac2s(*) = shape([1,2,3])
16 integer(8), parameter :: ac3s(*) = shape([(1,j=1,4)])
17 integer(8), parameter :: ac3bs(*) = shape([(1,j=4,1,-1)])
18 integer(8), parameter :: ac4s(*) = shape([((j,k,j*k,k=1,3),j=1,4)])
19 integer(8), parameter :: ac5s(*) = shape([((0,k=5,1,-2),j=9,2,-3)])
20 integer(8), parameter :: rss(*) = shape(reshape([(0,j=1,90)], -[2,3]*(-[5_8,3_8])))
21 contains
22 subroutine subr(x,n1,n2)
23 real, intent(in) :: x(:,:)
24 integer, intent(in) :: n1(3), n2(:)
25 real, allocatable :: a(:,:,:)
26 ! the following fail if we don't handle empty strings
27 Character(0) :: ch1(1,2,3) = Reshape([('',n=1,1*2*3)],[1,2,3])
28 Character(0) :: ch2(3) = reshape(['','',''], [3])
29 a = reshape(x,n1)
30 a = reshape(x,n2(10:30:9)) ! fails if we can't figure out triplet shape
31 end subroutine
32 end module m1
33 !Expect: m1.mod
34 ! module m1
35 ! integer(8),parameter::a0s(1_8:*)=[INTEGER(8)::]
36 ! intrinsic::shape
37 ! real(4)::a1(1_8:5_8,1_8:5_8,1_8:5_8)
38 ! integer(8),parameter::a1s(1_8:*)=[INTEGER(8)::5_8,5_8,5_8]
39 ! integer(8),parameter::a1ss(1_8:*)=[INTEGER(8)::3_8]
40 ! integer(8),parameter::a1sss(1_8:*)=[INTEGER(8)::1_8]
41 ! integer(8),parameter::a1rs(1_8:*)=[INTEGER(8)::3_8,1_8,1_8,1_8]
42 ! integer(8),parameter::a1n(1_8:*)=[INTEGER(8)::125_8,5_8,5_8]
43 ! integer(8),parameter::a1sn(1_8:*)=[INTEGER(8)::3_8,1_8,1_8]
44 ! integer(8),parameter::ac1s(1_8:*)=[INTEGER(8)::1_8]
45 ! integer(8),parameter::ac2s(1_8:*)=[INTEGER(8)::3_8]
46 ! integer(8),parameter::ac3s(1_8:*)=[INTEGER(8)::4_8]
47 ! integer(8),parameter::ac3bs(1_8:*)=[INTEGER(8)::4_8]
48 ! integer(8),parameter::ac4s(1_8:*)=[INTEGER(8)::36_8]
49 ! integer(8),parameter::ac5s(1_8:*)=[INTEGER(8)::9_8]
50 ! integer(8),parameter::rss(1_8:*)=[INTEGER(8)::10_8,9_8]
51 ! intrinsic::reshape
52 ! contains
53 ! subroutine subr(x,n1,n2)
54 ! real(4),intent(in)::x(:,:)
55 ! integer(4),intent(in)::n1(1_8:3_8)
56 ! integer(4),intent(in)::n2(:)
57 ! end
58 ! end