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