1*48a70ea1SPeixin-Qiao! RUN: %python %S/test_errors.py %s %flang_fc1 2*48a70ea1SPeixin-Qiao! Regression test for more than one part-ref with nonzero rank 3*48a70ea1SPeixin-Qiao 4*48a70ea1SPeixin-Qiaoprogram m 5*48a70ea1SPeixin-Qiao type mt 6*48a70ea1SPeixin-Qiao complex :: c, c2(2) 7*48a70ea1SPeixin-Qiao integer :: x, x2(2) 8*48a70ea1SPeixin-Qiao character(10) :: s, s2(2) 9*48a70ea1SPeixin-Qiao end type 10*48a70ea1SPeixin-Qiao type mt2 11*48a70ea1SPeixin-Qiao type(mt) :: t1(2,2) 12*48a70ea1SPeixin-Qiao end type 13*48a70ea1SPeixin-Qiao type mt3 14*48a70ea1SPeixin-Qiao type(mt2) :: t2(2) 15*48a70ea1SPeixin-Qiao end type 16*48a70ea1SPeixin-Qiao type mt4 17*48a70ea1SPeixin-Qiao type(mt3) :: t3(2) 18*48a70ea1SPeixin-Qiao end type 19*48a70ea1SPeixin-Qiao type(mt4) :: t(2) 20*48a70ea1SPeixin-Qiao 21*48a70ea1SPeixin-Qiao print *, t(1)%t3(1)%t2(1)%t1%x ! no error 22*48a70ea1SPeixin-Qiao print *, t(1)%t3(1)%t2(1)%t1%x2(1) ! no error 23*48a70ea1SPeixin-Qiao print *, t(1)%t3(1)%t2(1)%t1%s(1:2) ! no error 24*48a70ea1SPeixin-Qiao print *, t(1)%t3(1)%t2(1)%t1%s2(1)(1:2) ! no error 25*48a70ea1SPeixin-Qiao print *, t(1)%t3(1)%t2(1)%t1%c%RE ! no error 26*48a70ea1SPeixin-Qiao print *, t(1)%t3(1)%t2(1)%t1%c%IM ! no error 27*48a70ea1SPeixin-Qiao print *, t(1)%t3(1)%t2(1)%t1%c2(1)%RE ! no error 28*48a70ea1SPeixin-Qiao print *, t(1)%t3(1)%t2(1)%t1%c2(1)%IM ! no error 29*48a70ea1SPeixin-Qiao 30*48a70ea1SPeixin-Qiao !ERROR: Reference to whole rank-2 component 't1' of rank-1 array of derived type is not allowed 31*48a70ea1SPeixin-Qiao print *, t%t3%t2%t1%x 32*48a70ea1SPeixin-Qiao !ERROR: Reference to whole rank-2 component 't1' of rank-1 array of derived type is not allowed 33*48a70ea1SPeixin-Qiao print *, t(1)%t3%t2%t1%x 34*48a70ea1SPeixin-Qiao !ERROR: Reference to whole rank-2 component 't1' of rank-1 array of derived type is not allowed 35*48a70ea1SPeixin-Qiao print *, t(1)%t3(1)%t2%t1%x 36*48a70ea1SPeixin-Qiao !ERROR: Reference to whole rank-2 component 't1' of rank-1 array of derived type is not allowed 37*48a70ea1SPeixin-Qiao print *, t(1)%t3%t2(1)%t1%x 38*48a70ea1SPeixin-Qiao !ERROR: Reference to whole rank-2 component 't1' of rank-1 array of derived type is not allowed 39*48a70ea1SPeixin-Qiao print *, t%t3%t2%t1%x2(1) 40*48a70ea1SPeixin-Qiao !ERROR: Reference to whole rank-1 component 'x2' of rank-2 array of derived type is not allowed 41*48a70ea1SPeixin-Qiao print *, t(1)%t3%t2%t1%x2 42*48a70ea1SPeixin-Qiao !ERROR: Reference to whole rank-2 component 't1' of rank-1 array of derived type is not allowed 43*48a70ea1SPeixin-Qiao print *, t(1)%t3(1)%t2%t1%x2(1) 44*48a70ea1SPeixin-Qiao !ERROR: Subscripts of component 'x2' of rank-2 derived type array have rank 1 but must all be scalar 45*48a70ea1SPeixin-Qiao print *, t(1)%t3(1)%t2(1)%t1%x2(1:) 46*48a70ea1SPeixin-Qiao !ERROR: Reference to whole rank-2 component 't1' of rank-1 array of derived type is not allowed 47*48a70ea1SPeixin-Qiao print *, t%t3%t2%t1%s(1:2) 48*48a70ea1SPeixin-Qiao !ERROR: Reference to whole rank-2 component 't1' of rank-1 array of derived type is not allowed 49*48a70ea1SPeixin-Qiao print *, t(1)%t3%t2(1)%t1%s(1:2) 50*48a70ea1SPeixin-Qiao !ERROR: Subscripts of component 't1' of rank-1 derived type array have rank 1 but must all be scalar 51*48a70ea1SPeixin-Qiao print *, t%t3%t2%t1(1,:)%s(1:2) 52*48a70ea1SPeixin-Qiao !ERROR: Reference to whole rank-2 component 't1' of rank-1 array of derived type is not allowed 53*48a70ea1SPeixin-Qiao print *, t%t3%t2%t1%s2(1)(1:2) 54*48a70ea1SPeixin-Qiao !ERROR: Subscripts of component 's2' of rank-2 derived type array have rank 1 but must all be scalar 55*48a70ea1SPeixin-Qiao print *, t(1)%t3%t2%t1%s2(1:)(1:2) 56*48a70ea1SPeixin-Qiao !ERROR: Reference to whole rank-2 component 't1' of rank-1 array of derived type is not allowed 57*48a70ea1SPeixin-Qiao print *, t%t3%t2%t1%c%RE 58*48a70ea1SPeixin-Qiao !ERROR: Reference to whole rank-2 component 't1' of rank-1 array of derived type is not allowed 59*48a70ea1SPeixin-Qiao print *, t(1)%t3%t2%t1%c%RE 60*48a70ea1SPeixin-Qiao !ERROR: Reference to whole rank-2 component 't1' of rank-1 array of derived type is not allowed 61*48a70ea1SPeixin-Qiao print *, t(1)%t3(1)%t2%t1%c%RE 62*48a70ea1SPeixin-Qiao !ERROR: Reference to whole rank-2 component 't1' of rank-1 array of derived type is not allowed 63*48a70ea1SPeixin-Qiao print *, t(1)%t3%t2(1)%t1%c%RE 64*48a70ea1SPeixin-Qiao !ERROR: Reference to whole rank-2 component 't1' of rank-1 array of derived type is not allowed 65*48a70ea1SPeixin-Qiao print *, t%t3%t2%t1%c%IM 66*48a70ea1SPeixin-Qiao !ERROR: Reference to whole rank-2 component 't1' of rank-1 array of derived type is not allowed 67*48a70ea1SPeixin-Qiao print *, t%t3%t2%t1%c2(1)%RE 68*48a70ea1SPeixin-Qiao !ERROR: Reference to whole rank-2 component 't1' of rank-1 array of derived type is not allowed 69*48a70ea1SPeixin-Qiao print *, t(1)%t3%t2%t1%c2(1)%RE 70*48a70ea1SPeixin-Qiao !ERROR: Subscripts of component 'c2' of rank-2 derived type array have rank 1 but must all be scalar 71*48a70ea1SPeixin-Qiao print *, t(1)%t3(1)%t2%t1%c2(1:)%RE 72*48a70ea1SPeixin-Qiao !ERROR: Reference to whole rank-2 component 't1' of rank-1 array of derived type is not allowed 73*48a70ea1SPeixin-Qiao print *, t(1)%t3%t2(1)%t1%c2(1)%RE 74*48a70ea1SPeixin-Qiao !ERROR: Reference to whole rank-2 component 't1' of rank-1 array of derived type is not allowed 75*48a70ea1SPeixin-Qiao print *, t%t3%t2%t1%c2(1)%IM 76*48a70ea1SPeixin-Qiaoend 77