45 lines · plain
1! RUN: %python %S/test_errors.py %s %flang_fc1 -pedantic -Werror2 3! Ensure that FINAL subroutine can be called for array with vector-valued4! subscript.5 6module m7 type t18 contains9 final :: f110 end type11 type t212 contains13 final :: f214 end type15 type t316 contains17 final :: f318 end type19 contains20 subroutine f1(x)21 type(t1), intent(in out) :: x(:)22 end subroutine23 subroutine f2(x)24 type(t2), intent(in out) :: x(..)25 end subroutine26 impure elemental subroutine f3(x)27 type(t3), intent(in out) :: x28 end subroutine29end module30 31program test32 use m33 type(t1) x1(1)34 type(t2) x2(1)35 type(t3) x3(1)36 x1(:) = [t1()] ! ok37 x2(:) = [t2()] ! ok38 x3(:) = [t3()] ! ok39 !PORTABILITY: Variable 'x1([INTEGER(8)::1_8])' has a vector subscript and will be finalized by non-elemental subroutine 'f1' [-Wvector-subscript-finalization]40 x1([1]) = [t1()]41 !PORTABILITY: Variable 'x2([INTEGER(8)::1_8])' has a vector subscript and will be finalized by non-elemental subroutine 'f2' [-Wvector-subscript-finalization]42 x2([1]) = [t2()]43 x3([1]) = [t3()] ! ok44end45