[flang-commits] [flang] [Flang][Runtime] Fix type used to store result of typeInfo::Value::Ge… (PR #105589)
via flang-commits
flang-commits at lists.llvm.org
Wed Aug 21 14:33:20 PDT 2024
https://github.com/serge-sans-paille created https://github.com/llvm/llvm-project/pull/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.
>From d5635708099aefcc0900822cdc8623362ebc22fc Mon Sep 17 00:00:00 2001
From: serge-sans-paille <sguelton at mozilla.com>
Date: Wed, 21 Aug 2024 23:28:29 +0200
Subject: [PATCH] [Flang][Runtime] Fix type used to store result of
typeInfo::Value::GetValue
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.
---
flang/runtime/copy.cpp | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
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