[flang-commits] [flang] 410f751 - [Flang][Runtime] Fix type used to store result of typeInfo::Value::Ge… (#105589)
via flang-commits
flang-commits at lists.llvm.org
Wed Aug 21 23:11:36 PDT 2024
Author: serge-sans-paille
Date: 2024-08-22T06:11:34Z
New Revision: 410f751144e8b2e9574f03e0d0fb8560fe3cb797
URL: https://github.com/llvm/llvm-project/commit/410f751144e8b2e9574f03e0d0fb8560fe3cb797
DIFF: https://github.com/llvm/llvm-project/commit/410f751144e8b2e9574f03e0d0fb8560fe3cb797.diff
LOG: [Flang][Runtime] Fix type used to store result of typeInfo::Value::Ge… (#105589)
…tValue
Current choice was only working out of accident on 64 bit machine, it
led to an implicit cast to smaller type on 32 bit machine. Use the exact
type instead.
Added:
Modified:
flang/runtime/copy.cpp
Removed:
################################################################################
diff --git a/flang/runtime/copy.cpp b/flang/runtime/copy.cpp
index 41d2aef1a6865a..b20f68f019498b 100644
--- a/flang/runtime/copy.cpp
+++ b/flang/runtime/copy.cpp
@@ -183,8 +183,9 @@ RT_API_ATTRS void CopyElement(const Descriptor &to, const SubscriptValue toAt[],
const typeInfo::Value *bounds{component->bounds()};
std::size_t elements{1};
for (int dim{0}; dim < component->rank(); ++dim) {
- SubscriptValue lb{bounds[2 * dim].GetValue(&curTo).value_or(0)};
- SubscriptValue ub{
+ typeInfo::TypeParameterValue lb{
+ bounds[2 * dim].GetValue(&curTo).value_or(0)};
+ typeInfo::TypeParameterValue ub{
bounds[2 * dim + 1].GetValue(&curTo).value_or(0)};
extents[dim] = ub >= lb ? ub - lb + 1 : 0;
elements *= extents[dim];
More information about the flang-commits
mailing list