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 interface 6 function real_info1(i) 7 end 8 subroutine real_info2() 9 end 10 subroutine real_generic() 11 end 12 end interface 13 type mt 14 complex :: c, c2(2) 15 integer :: x, x2(2) 16 character(10) :: s, s2(2) 17 contains 18 procedure, nopass :: info1 => real_info1 19 procedure, nopass :: info2 => real_info2 20 procedure, nopass :: real_generic 21 generic :: g1 => real_generic 22 end type 23 type mt2 24 type(mt) :: t1(2,2) 25 end type 26 type mt3 27 type(mt2) :: t2(2) 28 end type 29 type mt4 30 type(mt3) :: t3(2) 31 end type 32 type(mt4) :: t(2) 33 34 print *, t(1)%t3(1)%t2(1)%t1%x ! no error 35 print *, t(1)%t3(1)%t2(1)%t1%x2(1) ! no error 36 print *, t(1)%t3(1)%t2(1)%t1%s(1:2) ! no error 37 print *, t(1)%t3(1)%t2(1)%t1%s2(1)(1:2) ! no error 38 print *, t(1)%t3(1)%t2(1)%t1%c%RE ! no error 39 print *, t(1)%t3(1)%t2(1)%t1%c%IM ! no error 40 print *, t(1)%t3(1)%t2(1)%t1%c2(1)%RE ! no error 41 print *, t(1)%t3(1)%t2(1)%t1%c2(1)%IM ! no error 42 43 !ERROR: Reference to whole rank-2 component 't1' of rank-1 array of derived type is not allowed 44 print *, t%t3%t2%t1%x 45 !ERROR: Reference to whole rank-2 component 't1' of rank-1 array of derived type is not allowed 46 print *, t(1)%t3%t2%t1%x 47 !ERROR: Reference to whole rank-2 component 't1' of rank-1 array of derived type is not allowed 48 print *, t(1)%t3(1)%t2%t1%x 49 !ERROR: Reference to whole rank-2 component 't1' of rank-1 array of derived type is not allowed 50 print *, t(1)%t3%t2(1)%t1%x 51 !ERROR: Reference to whole rank-2 component 't1' of rank-1 array of derived type is not allowed 52 print *, t%t3%t2%t1%x2(1) 53 !ERROR: Reference to whole rank-1 component 'x2' of rank-2 array of derived type is not allowed 54 print *, t(1)%t3%t2%t1%x2 55 !ERROR: Reference to whole rank-2 component 't1' of rank-1 array of derived type is not allowed 56 print *, t(1)%t3(1)%t2%t1%x2(1) 57 !ERROR: Subscripts of component 'x2' of rank-2 derived type array have rank 1 but must all be scalar 58 print *, t(1)%t3(1)%t2(1)%t1%x2(1:) 59 !ERROR: Reference to whole rank-2 component 't1' of rank-1 array of derived type is not allowed 60 print *, t%t3%t2%t1%s(1:2) 61 !ERROR: Reference to whole rank-2 component 't1' of rank-1 array of derived type is not allowed 62 print *, t(1)%t3%t2(1)%t1%s(1:2) 63 !ERROR: Subscripts of component 't1' of rank-1 derived type array have rank 1 but must all be scalar 64 print *, t%t3%t2%t1(1,:)%s(1:2) 65 !ERROR: Reference to whole rank-2 component 't1' of rank-1 array of derived type is not allowed 66 print *, t%t3%t2%t1%s2(1)(1:2) 67 !ERROR: Subscripts of component 's2' of rank-2 derived type array have rank 1 but must all be scalar 68 print *, t(1)%t3%t2%t1%s2(1:)(1:2) 69 !ERROR: Reference to whole rank-2 component 't1' of rank-1 array of derived type is not allowed 70 print *, t%t3%t2%t1%c%RE 71 !ERROR: Reference to whole rank-2 component 't1' of rank-1 array of derived type is not allowed 72 print *, t(1)%t3%t2%t1%c%RE 73 !ERROR: Reference to whole rank-2 component 't1' of rank-1 array of derived type is not allowed 74 print *, t(1)%t3(1)%t2%t1%c%RE 75 !ERROR: Reference to whole rank-2 component 't1' of rank-1 array of derived type is not allowed 76 print *, t(1)%t3%t2(1)%t1%c%RE 77 !ERROR: Reference to whole rank-2 component 't1' of rank-1 array of derived type is not allowed 78 print *, t%t3%t2%t1%c%IM 79 !ERROR: Reference to whole rank-2 component 't1' of rank-1 array of derived type is not allowed 80 print *, t%t3%t2%t1%c2(1)%RE 81 !ERROR: Reference to whole rank-2 component 't1' of rank-1 array of derived type is not allowed 82 print *, t(1)%t3%t2%t1%c2(1)%RE 83 !ERROR: Subscripts of component 'c2' of rank-2 derived type array have rank 1 but must all be scalar 84 print *, t(1)%t3(1)%t2%t1%c2(1:)%RE 85 !ERROR: Reference to whole rank-2 component 't1' of rank-1 array of derived type is not allowed 86 print *, t(1)%t3%t2(1)%t1%c2(1)%RE 87 !ERROR: Reference to whole rank-2 component 't1' of rank-1 array of derived type is not allowed 88 print *, t%t3%t2%t1%c2(1)%IM 89 90 !ERROR: Reference to whole rank-2 component 't1' of rank-1 array of derived type is not allowed 91 call sub0(t%t3%t2%t1%info1(i)) 92 !ERROR: Reference to whole rank-2 component 't1' of rank-1 array of derived type is not allowed 93 call t%t3%t2%t1%info2 94 !ERROR: Reference to whole rank-2 component 't1' of rank-1 array of derived type is not allowed 95 call t%t3%t2%t1%g1 96 97 !ERROR: Reference to rank-2 object 't1' has 1 subscripts 98 call sub0(t%t3%t2%t1(1)%info1(i)) 99 !ERROR: Reference to rank-2 object 't1' has 1 subscripts 100 call t%t3%t2%t1(1)%info2 101 !ERROR: Reference to rank-2 object 't1' has 1 subscripts 102 call t%t3%t2%t1(1)%g1 103 104 !ERROR: Reference to rank-2 object 't1' has 1 subscripts 105 call sub0(t%t3%t2%t1(1:)%info1(i)) 106 !ERROR: Reference to rank-2 object 't1' has 1 subscripts 107 call t%t3%t2%t1(1:)%info2 108 !ERROR: Reference to rank-2 object 't1' has 1 subscripts 109 call t%t3%t2%t1(1:)%g1 110 111end 112