[llvm] Fix the type of offset that broke 32-bit flang-rt build to use `uint64_t` consistently (PR #147359)
Daniel Chen via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 7 10:56:56 PDT 2025
https://github.com/DanielCChen created https://github.com/llvm/llvm-project/pull/147359
The recent change of `flang-rt` has code like `std::size_t offset{offset_};`.
It broke the 32-bit `flang-rt` build because `Component::offset_` is of type `uint64_t` but `size_t` varies.
This patch is to use consistent`uint64_t` for offset.
>From ebe26d2e7aaab6d6f56363d1698343f74b0f0c8a Mon Sep 17 00:00:00 2001
From: Daniel Chen <cdchen at ca.ibm.com>
Date: Mon, 7 Jul 2025 13:50:00 -0400
Subject: [PATCH] Fix the type of offset that broke 32-bit flang-rt build.
---
flang-rt/lib/runtime/assign.cpp | 4 ++--
flang-rt/lib/runtime/type-info.cpp | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/flang-rt/lib/runtime/assign.cpp b/flang-rt/lib/runtime/assign.cpp
index f936a4192a33c..b18e8a7ced96b 100644
--- a/flang-rt/lib/runtime/assign.cpp
+++ b/flang-rt/lib/runtime/assign.cpp
@@ -598,7 +598,7 @@ RT_API_ATTRS int DerivedAssignTicket<IS_COMPONENTWISE>::Continue(
std::size_t componentByteSize{
this->component_->SizeInBytes(this->instance_)};
if (IS_COMPONENTWISE && toIsContiguous_ && fromIsContiguous_) {
- std::size_t offset{this->component_->offset()};
+ std::uint64_t offset{this->component_->offset()};
char *to{this->instance_.template OffsetElement<char>(offset)};
const char *from{
this->from_->template OffsetElement<const char>(offset)};
@@ -630,7 +630,7 @@ RT_API_ATTRS int DerivedAssignTicket<IS_COMPONENTWISE>::Continue(
std::size_t componentByteSize{
this->component_->SizeInBytes(this->instance_)};
if (IS_COMPONENTWISE && toIsContiguous_ && fromIsContiguous_) {
- std::size_t offset{this->component_->offset()};
+ std::uint64_t offset{this->component_->offset()};
char *to{this->instance_.template OffsetElement<char>(offset)};
const char *from{
this->from_->template OffsetElement<const char>(offset)};
diff --git a/flang-rt/lib/runtime/type-info.cpp b/flang-rt/lib/runtime/type-info.cpp
index d023c3392d559..e21c730e06fa1 100644
--- a/flang-rt/lib/runtime/type-info.cpp
+++ b/flang-rt/lib/runtime/type-info.cpp
@@ -140,7 +140,7 @@ RT_API_ATTRS void Component::CreatePointerDescriptor(Descriptor &descriptor,
const SubscriptValue *subscripts) const {
RUNTIME_CHECK(terminator, genre_ == Genre::Data);
EstablishDescriptor(descriptor, container, terminator);
- std::size_t offset{offset_};
+ std::uint64_t offset{offset_};
if (subscripts) {
offset += container.SubscriptsToByteOffset(subscripts);
}
More information about the llvm-commits
mailing list