148a70ea1SPeixin-Qiao! RUN: %python %S/test_errors.py %s %flang_fc1 248a70ea1SPeixin-Qiao! Regression test for more than one part-ref with nonzero rank 348a70ea1SPeixin-Qiao 448a70ea1SPeixin-Qiaoprogram m 5*c6d8aa27SPeixin-Qiao interface 6*c6d8aa27SPeixin-Qiao function real_info1(i) 7*c6d8aa27SPeixin-Qiao end 8*c6d8aa27SPeixin-Qiao subroutine real_info2() 9*c6d8aa27SPeixin-Qiao end 10*c6d8aa27SPeixin-Qiao subroutine real_generic() 11*c6d8aa27SPeixin-Qiao end 12*c6d8aa27SPeixin-Qiao end interface 1348a70ea1SPeixin-Qiao type mt 1448a70ea1SPeixin-Qiao complex :: c, c2(2) 1548a70ea1SPeixin-Qiao integer :: x, x2(2) 1648a70ea1SPeixin-Qiao character(10) :: s, s2(2) 17*c6d8aa27SPeixin-Qiao contains 18*c6d8aa27SPeixin-Qiao procedure, nopass :: info1 => real_info1 19*c6d8aa27SPeixin-Qiao procedure, nopass :: info2 => real_info2 20*c6d8aa27SPeixin-Qiao procedure, nopass :: real_generic 21*c6d8aa27SPeixin-Qiao generic :: g1 => real_generic 2248a70ea1SPeixin-Qiao end type 2348a70ea1SPeixin-Qiao type mt2 2448a70ea1SPeixin-Qiao type(mt) :: t1(2,2) 2548a70ea1SPeixin-Qiao end type 2648a70ea1SPeixin-Qiao type mt3 2748a70ea1SPeixin-Qiao type(mt2) :: t2(2) 2848a70ea1SPeixin-Qiao end type 2948a70ea1SPeixin-Qiao type mt4 3048a70ea1SPeixin-Qiao type(mt3) :: t3(2) 3148a70ea1SPeixin-Qiao end type 3248a70ea1SPeixin-Qiao type(mt4) :: t(2) 3348a70ea1SPeixin-Qiao 3448a70ea1SPeixin-Qiao print *, t(1)%t3(1)%t2(1)%t1%x ! no error 3548a70ea1SPeixin-Qiao print *, t(1)%t3(1)%t2(1)%t1%x2(1) ! no error 3648a70ea1SPeixin-Qiao print *, t(1)%t3(1)%t2(1)%t1%s(1:2) ! no error 3748a70ea1SPeixin-Qiao print *, t(1)%t3(1)%t2(1)%t1%s2(1)(1:2) ! no error 3848a70ea1SPeixin-Qiao print *, t(1)%t3(1)%t2(1)%t1%c%RE ! no error 3948a70ea1SPeixin-Qiao print *, t(1)%t3(1)%t2(1)%t1%c%IM ! no error 4048a70ea1SPeixin-Qiao print *, t(1)%t3(1)%t2(1)%t1%c2(1)%RE ! no error 4148a70ea1SPeixin-Qiao print *, t(1)%t3(1)%t2(1)%t1%c2(1)%IM ! no error 4248a70ea1SPeixin-Qiao 4348a70ea1SPeixin-Qiao !ERROR: Reference to whole rank-2 component 't1' of rank-1 array of derived type is not allowed 4448a70ea1SPeixin-Qiao print *, t%t3%t2%t1%x 4548a70ea1SPeixin-Qiao !ERROR: Reference to whole rank-2 component 't1' of rank-1 array of derived type is not allowed 4648a70ea1SPeixin-Qiao print *, t(1)%t3%t2%t1%x 4748a70ea1SPeixin-Qiao !ERROR: Reference to whole rank-2 component 't1' of rank-1 array of derived type is not allowed 4848a70ea1SPeixin-Qiao print *, t(1)%t3(1)%t2%t1%x 4948a70ea1SPeixin-Qiao !ERROR: Reference to whole rank-2 component 't1' of rank-1 array of derived type is not allowed 5048a70ea1SPeixin-Qiao print *, t(1)%t3%t2(1)%t1%x 5148a70ea1SPeixin-Qiao !ERROR: Reference to whole rank-2 component 't1' of rank-1 array of derived type is not allowed 5248a70ea1SPeixin-Qiao print *, t%t3%t2%t1%x2(1) 5348a70ea1SPeixin-Qiao !ERROR: Reference to whole rank-1 component 'x2' of rank-2 array of derived type is not allowed 5448a70ea1SPeixin-Qiao print *, t(1)%t3%t2%t1%x2 5548a70ea1SPeixin-Qiao !ERROR: Reference to whole rank-2 component 't1' of rank-1 array of derived type is not allowed 5648a70ea1SPeixin-Qiao print *, t(1)%t3(1)%t2%t1%x2(1) 5748a70ea1SPeixin-Qiao !ERROR: Subscripts of component 'x2' of rank-2 derived type array have rank 1 but must all be scalar 5848a70ea1SPeixin-Qiao print *, t(1)%t3(1)%t2(1)%t1%x2(1:) 5948a70ea1SPeixin-Qiao !ERROR: Reference to whole rank-2 component 't1' of rank-1 array of derived type is not allowed 6048a70ea1SPeixin-Qiao print *, t%t3%t2%t1%s(1:2) 6148a70ea1SPeixin-Qiao !ERROR: Reference to whole rank-2 component 't1' of rank-1 array of derived type is not allowed 6248a70ea1SPeixin-Qiao print *, t(1)%t3%t2(1)%t1%s(1:2) 6348a70ea1SPeixin-Qiao !ERROR: Subscripts of component 't1' of rank-1 derived type array have rank 1 but must all be scalar 6448a70ea1SPeixin-Qiao print *, t%t3%t2%t1(1,:)%s(1:2) 6548a70ea1SPeixin-Qiao !ERROR: Reference to whole rank-2 component 't1' of rank-1 array of derived type is not allowed 6648a70ea1SPeixin-Qiao print *, t%t3%t2%t1%s2(1)(1:2) 6748a70ea1SPeixin-Qiao !ERROR: Subscripts of component 's2' of rank-2 derived type array have rank 1 but must all be scalar 6848a70ea1SPeixin-Qiao print *, t(1)%t3%t2%t1%s2(1:)(1:2) 6948a70ea1SPeixin-Qiao !ERROR: Reference to whole rank-2 component 't1' of rank-1 array of derived type is not allowed 7048a70ea1SPeixin-Qiao print *, t%t3%t2%t1%c%RE 7148a70ea1SPeixin-Qiao !ERROR: Reference to whole rank-2 component 't1' of rank-1 array of derived type is not allowed 7248a70ea1SPeixin-Qiao print *, t(1)%t3%t2%t1%c%RE 7348a70ea1SPeixin-Qiao !ERROR: Reference to whole rank-2 component 't1' of rank-1 array of derived type is not allowed 7448a70ea1SPeixin-Qiao print *, t(1)%t3(1)%t2%t1%c%RE 7548a70ea1SPeixin-Qiao !ERROR: Reference to whole rank-2 component 't1' of rank-1 array of derived type is not allowed 7648a70ea1SPeixin-Qiao print *, t(1)%t3%t2(1)%t1%c%RE 7748a70ea1SPeixin-Qiao !ERROR: Reference to whole rank-2 component 't1' of rank-1 array of derived type is not allowed 7848a70ea1SPeixin-Qiao print *, t%t3%t2%t1%c%IM 7948a70ea1SPeixin-Qiao !ERROR: Reference to whole rank-2 component 't1' of rank-1 array of derived type is not allowed 8048a70ea1SPeixin-Qiao print *, t%t3%t2%t1%c2(1)%RE 8148a70ea1SPeixin-Qiao !ERROR: Reference to whole rank-2 component 't1' of rank-1 array of derived type is not allowed 8248a70ea1SPeixin-Qiao print *, t(1)%t3%t2%t1%c2(1)%RE 8348a70ea1SPeixin-Qiao !ERROR: Subscripts of component 'c2' of rank-2 derived type array have rank 1 but must all be scalar 8448a70ea1SPeixin-Qiao print *, t(1)%t3(1)%t2%t1%c2(1:)%RE 8548a70ea1SPeixin-Qiao !ERROR: Reference to whole rank-2 component 't1' of rank-1 array of derived type is not allowed 8648a70ea1SPeixin-Qiao print *, t(1)%t3%t2(1)%t1%c2(1)%RE 8748a70ea1SPeixin-Qiao !ERROR: Reference to whole rank-2 component 't1' of rank-1 array of derived type is not allowed 8848a70ea1SPeixin-Qiao print *, t%t3%t2%t1%c2(1)%IM 89*c6d8aa27SPeixin-Qiao 90*c6d8aa27SPeixin-Qiao !ERROR: Reference to whole rank-2 component 't1' of rank-1 array of derived type is not allowed 91*c6d8aa27SPeixin-Qiao call sub0(t%t3%t2%t1%info1(i)) 92*c6d8aa27SPeixin-Qiao !ERROR: Reference to whole rank-2 component 't1' of rank-1 array of derived type is not allowed 93*c6d8aa27SPeixin-Qiao call t%t3%t2%t1%info2 94*c6d8aa27SPeixin-Qiao !ERROR: Reference to whole rank-2 component 't1' of rank-1 array of derived type is not allowed 95*c6d8aa27SPeixin-Qiao call t%t3%t2%t1%g1 96*c6d8aa27SPeixin-Qiao 97*c6d8aa27SPeixin-Qiao !ERROR: Reference to rank-2 object 't1' has 1 subscripts 98*c6d8aa27SPeixin-Qiao call sub0(t%t3%t2%t1(1)%info1(i)) 99*c6d8aa27SPeixin-Qiao !ERROR: Reference to rank-2 object 't1' has 1 subscripts 100*c6d8aa27SPeixin-Qiao call t%t3%t2%t1(1)%info2 101*c6d8aa27SPeixin-Qiao !ERROR: Reference to rank-2 object 't1' has 1 subscripts 102*c6d8aa27SPeixin-Qiao call t%t3%t2%t1(1)%g1 103*c6d8aa27SPeixin-Qiao 104*c6d8aa27SPeixin-Qiao !ERROR: Reference to rank-2 object 't1' has 1 subscripts 105*c6d8aa27SPeixin-Qiao call sub0(t%t3%t2%t1(1:)%info1(i)) 106*c6d8aa27SPeixin-Qiao !ERROR: Reference to rank-2 object 't1' has 1 subscripts 107*c6d8aa27SPeixin-Qiao call t%t3%t2%t1(1:)%info2 108*c6d8aa27SPeixin-Qiao !ERROR: Reference to rank-2 object 't1' has 1 subscripts 109*c6d8aa27SPeixin-Qiao call t%t3%t2%t1(1:)%g1 110*c6d8aa27SPeixin-Qiao 11148a70ea1SPeixin-Qiaoend 112