[flang-commits] [flang] a734de6 - [flang] semantic checking for unsupported features in PPC vector type

Kelvin Li via flang-commits flang-commits at lists.llvm.org
Wed Jun 14 07:44:30 PDT 2023


Author: Kelvin Li
Date: 2023-06-14T10:44:16-04:00
New Revision: a734de6d3753b5ac8c58a68d28deaaaadd1d30fe

URL: https://github.com/llvm/llvm-project/commit/a734de6d3753b5ac8c58a68d28deaaaadd1d30fe
DIFF: https://github.com/llvm/llvm-project/commit/a734de6d3753b5ac8c58a68d28deaaaadd1d30fe.diff

LOG: [flang] semantic checking for unsupported features in PPC vector type

Assumed-shape, deferred-shape and assumed rank entities of PPC vector
type are not supported.

Differential Revision: https://reviews.llvm.org/D152864

Added: 
    flang/test/Semantics/PowerPC/ppc-vector-types04.f90

Modified: 
    flang/lib/Optimizer/Dialect/FIRType.cpp
    flang/lib/Semantics/check-declarations.cpp

Removed: 
    


################################################################################
diff  --git a/flang/lib/Optimizer/Dialect/FIRType.cpp b/flang/lib/Optimizer/Dialect/FIRType.cpp
index efd74e09661c8..9e1a1f613d50e 100644
--- a/flang/lib/Optimizer/Dialect/FIRType.cpp
+++ b/flang/lib/Optimizer/Dialect/FIRType.cpp
@@ -1014,7 +1014,7 @@ mlir::LogicalResult fir::SequenceType::verify(
   // DIMENSION attribute can only be applied to an intrinsic or record type
   if (eleTy.isa<BoxType, BoxCharType, BoxProcType, ShapeType, ShapeShiftType,
                 ShiftType, SliceType, FieldType, LenType, HeapType, PointerType,
-                ReferenceType, TypeDescType, fir::VectorType, SequenceType>())
+                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
index 4b70fb19c551a..baf7af2b60611 100644
--- a/flang/lib/Semantics/check-declarations.cpp
+++ b/flang/lib/Semantics/check-declarations.cpp
@@ -1001,6 +1001,24 @@ void CheckHelper::CheckObjectEntity(
           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
index 0000000000000..6842233cab998
--- /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


        


More information about the flang-commits mailing list