[flang-commits] [PATCH] D121145: [flang] Runtime validation of SPREAD(DIM=dim) argument

Peter Klausler via Phabricator via flang-commits flang-commits at lists.llvm.org
Mon Mar 7 13:49:49 PST 2022


This revision was automatically updated to reflect the committed changes.
Closed by commit rG764363368c53: [flang] Runtime validation of SPREAD(DIM=dim) argument (authored by klausler).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D121145

Files:
  flang/runtime/transformational.cpp


Index: flang/runtime/transformational.cpp
===================================================================
--- flang/runtime/transformational.cpp
+++ flang/runtime/transformational.cpp
@@ -456,6 +456,11 @@
   Terminator terminator{sourceFile, line};
   int rank{source.rank() + 1};
   RUNTIME_CHECK(terminator, rank <= maxRank);
+  if (dim < 1 || dim > rank) {
+    terminator.Crash("SPREAD: DIM=%d argument for rank-%d source array "
+                     "must be greater than 1 and less than or equal to %d",
+        dim, rank - 1, rank);
+  }
   ncopies = std::max<std::int64_t>(ncopies, 0);
   SubscriptValue extent[maxRank];
   int k{0};


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D121145.413623.patch
Type: text/x-patch
Size: 648 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/flang-commits/attachments/20220307/62a9403e/attachment.bin>


More information about the flang-commits mailing list