diff --git a/flang/lib/Optimizer/Dialect/FIRType.cpp b/flang/lib/Optimizer/Dialect/FIRType.cpp --- a/flang/lib/Optimizer/Dialect/FIRType.cpp +++ b/flang/lib/Optimizer/Dialect/FIRType.cpp @@ -1014,7 +1014,7 @@ // DIMENSION attribute can only be applied to an intrinsic or record type if (eleTy.isa()) + ReferenceType, TypeDescType, SequenceType>()) return emitError() << "cannot build an array of this element type: " << eleTy << '\n'; return mlir::success(); diff --git a/flang/lib/Semantics/check-declarations.cpp b/flang/lib/Semantics/check-declarations.cpp --- a/flang/lib/Semantics/check-declarations.cpp +++ b/flang/lib/Semantics/check-declarations.cpp @@ -1001,6 +1001,24 @@ parser::ToUpperCaseLetters(common::EnumToString(attr))); } } + + if (derived && derived->IsVectorType()) { + CHECK(type); + std::string typeName{type->AsFortran()}; + if (IsAssumedShape(symbol)) { + SayWithDeclaration(symbol, + "Assumed-shape entity of %s type is not supported"_err_en_US, + typeName); + } else if (IsDeferredShape(symbol)) { + SayWithDeclaration(symbol, + "Deferred-shape entity of %s type is not supported"_err_en_US, + typeName); + } else if (evaluate::IsAssumedRank(symbol)) { + SayWithDeclaration(symbol, + "Assumed Rank entity of %s type is not supported"_err_en_US, + typeName); + } + } } void CheckHelper::CheckPointerInitialization(const Symbol &symbol) { diff --git a/flang/test/Semantics/PowerPC/ppc-vector-types04.f90 b/flang/test/Semantics/PowerPC/ppc-vector-types04.f90 new file mode 100644 --- /dev/null +++ b/flang/test/Semantics/PowerPC/ppc-vector-types04.f90 @@ -0,0 +1,47 @@ +! RUN: %python %S/../test_errors.py %s %flang_fc1 +! REQUIRES: target=powerpc{{.*}} + +subroutine vec_type_test(arg1, arg2, arg3, arg4) +!ERROR: Assumed-shape entity of vector(real(4)) type is not supported + vector(real) :: arg1(:) +!ERROR: Assumed Rank entity of vector(unsigned(4)) type is not supported + vector(unsigned) :: arg2(..) +!ERROR: Deferred-shape entity of vector(integer(4)) type is not supported + vector(integer), allocatable :: arg3(:) +!ERROR: Deferred-shape entity of vector(integer(4)) type is not supported + vector(integer), pointer :: arg4(:) +!ERROR: Deferred-shape entity of vector(integer(4)) type is not supported + vector(integer), allocatable :: var1(:) +!ERROR: Deferred-shape entity of vector(integer(4)) type is not supported + vector(integer), pointer :: var2(:) +end subroutine vec_type_test + +subroutine vec_pair_type_test(arg1, arg2, arg3, arg4) +!ERROR: Assumed-shape entity of __vector_pair type is not supported + __vector_pair :: arg1(:) +!ERROR: Assumed Rank entity of __vector_pair type is not supported + __vector_pair :: arg2(..) +!ERROR: Deferred-shape entity of __vector_pair type is not supported + __vector_pair, allocatable :: arg3(:) +!ERROR: Deferred-shape entity of __vector_pair type is not supported + __vector_pair, pointer :: arg4(:) +!ERROR: Deferred-shape entity of __vector_pair type is not supported + __vector_pair, allocatable :: var1(:) +!ERROR: Deferred-shape entity of __vector_pair type is not supported + __vector_pair, pointer :: var2(:) +end subroutine vec_pair_type_test + +subroutine vec_quad_type_test(arg1, arg2, arg3, arg4) +!ERROR: Assumed-shape entity of __vector_quad type is not supported + __vector_quad :: arg1(:) +!ERROR: Assumed Rank entity of __vector_quad type is not supported + __vector_quad :: arg2(..) +!ERROR: Deferred-shape entity of __vector_quad type is not supported + __vector_quad, allocatable :: arg3(:) +!ERROR: Deferred-shape entity of __vector_quad type is not supported + __vector_quad, pointer :: arg4(:) +!ERROR: Deferred-shape entity of __vector_quad type is not supported + __vector_quad, allocatable :: var1(:) +!ERROR: Deferred-shape entity of __vector_quad type is not supported + __vector_quad, pointer :: var2(:) +end subroutine vec_quad_type_test