[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:53 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-flang-runtime
Author: None (serge-sans-paille)
<details>
<summary>Changes</summary>
…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.
---
Full diff: https://github.com/llvm/llvm-project/pull/105589.diff
1 Files Affected:
- (modified) flang/runtime/copy.cpp (+3-2)
``````````diff
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];
``````````
</details>
https://github.com/llvm/llvm-project/pull/105589
More information about the flang-commits
mailing list