[PATCH] D78160: [flang] Checks for constraints C741 through C750

Tim Keith via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 14 16:20:28 PDT 2020


tskeith added inline comments.


================
Comment at: flang/lib/Evaluate/check-expression.cpp:248
+            "rank same_type_as shape size storage_size tiny ubound ucobound"};
+        if (inquiryIntrinsics.find(intrin.name) != std::string::npos &&
+            !IsConstantExpr(x)) {
----------------
This test and the one above only work if there are no other intrinsics that can be returned by `GetSpecificIntrinsic` whose names are not substrings of one of the names in the string. For example, if `intrin.name` is "max", it will find it in `inquiryIntrinsics`.

It seems like a set would be a better representation than a string. Or maybe an addition to the intrinsics table?


================
Comment at: flang/lib/Semantics/tools.cpp:277
+    const SubprogramDetails *funcDetails{symbol.detailsIf<SubprogramDetails>()};
+    if (funcDetails) {
+      const MaybeExpr &expr{funcDetails->stmtFunction()};
----------------
If symbol is a statement function it must have SubprogramDetails. So you can use `symbol.get<SubprogramDetails>()` instead.


================
Comment at: flang/test/Semantics/resolve88.f90:49
+  type c_ptrCoarrayType
+    !ERROR: A coarray component may not be of type C_PTR or C_FUNPTR from ISO_C_BINDING when an allocatable object is a coarray
+    type(c_ptr), allocatable, codimension[:] :: field
----------------
Why is "when an allocatable object is a coarray" here but not in the TEAM_TYPE message?


================
Comment at: flang/test/Semantics/resolve88.f90:67
+    type(coarrayType) :: goodField
+    !ERROR: A component with a POINTER or ALLOCATABLE attribute may not be of a type with a coarray ultimate component (named '%goodcoarrayfield')
+    type(coarrayType), pointer :: pointerField
----------------
Why '%goodcoarrayfield' rather than 'goodcoarrayfield'?


================
Comment at: flang/test/Semantics/resolve88.f90:71
+    type(coarrayType), allocatable :: allocatableField
+    !ERROR: An array or coarray component may not be of a type with a coarray  ultimate component (named '%goodcoarrayfield')
+    type(coarrayType), dimension(3) :: arrayField
----------------
There is an extra space between "coarray" and "ultimate".


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D78160/new/

https://reviews.llvm.org/D78160





More information about the llvm-commits mailing list