[flang-commits] [PATCH] D112347: [flang] Fix NAMELIST input bug with multiple subscript triplets
Peter Klausler via Phabricator via flang-commits
flang-commits at lists.llvm.org
Fri Oct 22 16:02:15 PDT 2021
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG89a927c67812: [flang] Fix NAMELIST input bug with multiple subscript triplets (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/D112347/new/
https://reviews.llvm.org/D112347
Files:
flang/runtime/namelist.cpp
Index: flang/runtime/namelist.cpp
===================================================================
--- flang/runtime/namelist.cpp
+++ flang/runtime/namelist.cpp
@@ -10,6 +10,7 @@
#include "descriptor-io.h"
#include "io-stmt.h"
#include "flang/Runtime/io-api.h"
+#include <algorithm>
#include <cstring>
#include <limits>
@@ -133,7 +134,7 @@
// ambiguous within the parentheses.
SubscriptValue lower[maxRank], upper[maxRank], stride[maxRank];
int j{0};
- std::size_t elemLen{source.ElementBytes()};
+ std::size_t contiguousStride{source.ElementBytes()};
bool ok{true};
std::optional<char32_t> ch{io.GetNextNonBlank()};
for (; ch && *ch != ')'; ++j) {
@@ -142,7 +143,9 @@
const Dimension &dim{source.GetDimension(j)};
dimLower = dim.LowerBound();
dimUpper = dim.UpperBound();
- dimStride = elemLen ? dim.ByteStride() / elemLen : 1;
+ dimStride =
+ dim.ByteStride() / std::max<SubscriptValue>(contiguousStride, 1);
+ contiguousStride *= dim.Extent();
} else if (ok) {
handler.SignalError(
"Too many subscripts for rank-%d NAMELIST group item '%s'",
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D112347.381678.patch
Type: text/x-patch
Size: 1143 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/flang-commits/attachments/20211022/8c601039/attachment.bin>
More information about the flang-commits
mailing list