[flang-commits] [PATCH] D132153: [flang][runtime] Improve error message for incompatible MATMUL arguments

Peter Klausler via Phabricator via flang-commits flang-commits at lists.llvm.org
Thu Aug 18 11:12:40 PDT 2022


klausler created this revision.
klausler added a reviewer: vdonaldson.
klausler added a project: Flang.
Herald added a subscriber: jdoerfert.
Herald added a project: All.
klausler requested review of this revision.

Print the full shapes of both argument when the dimensions that must
match do not do so.


https://reviews.llvm.org/D132153

Files:
  flang/runtime/matmul.cpp


Index: flang/runtime/matmul.cpp
===================================================================
--- flang/runtime/matmul.cpp
+++ flang/runtime/matmul.cpp
@@ -184,9 +184,11 @@
   }
   SubscriptValue n{x.GetDimension(xRank - 1).Extent()};
   if (n != y.GetDimension(0).Extent()) {
-    terminator.Crash("MATMUL: arrays do not conform (%jd != %jd)",
+    terminator.Crash("MATMUL: unacceptable operand shapes (%jdx%jd, %jdx%jd)",
+        static_cast<std::intmax_t>(x.GetDimension(0).Extent()),
         static_cast<std::intmax_t>(n),
-        static_cast<std::intmax_t>(y.GetDimension(0).Extent()));
+        static_cast<std::intmax_t>(y.GetDimension(0).Extent()),
+        static_cast<std::intmax_t>(y.GetDimension(1).Extent()));
   }
   using WriteResult =
       CppTypeFor<RCAT == TypeCategory::Logical ? TypeCategory::Integer : RCAT,


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D132153.453716.patch
Type: text/x-patch
Size: 841 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/flang-commits/attachments/20220818/7eb61452/attachment.bin>


More information about the flang-commits mailing list