[flang-commits] [flang] 6db2465 - [Flang][Runtime] Fix implicit conversion warning when targeting 32bit… (#99465)

via flang-commits flang-commits at lists.llvm.org
Sun Jul 21 11:58:00 PDT 2024


Author: serge-sans-paille
Date: 2024-07-21T18:57:56Z
New Revision: 6db2465ce74141f378a290cfa3b56eb69dc379cb

URL: https://github.com/llvm/llvm-project/commit/6db2465ce74141f378a290cfa3b56eb69dc379cb
DIFF: https://github.com/llvm/llvm-project/commit/6db2465ce74141f378a290cfa3b56eb69dc379cb.diff

LOG: [Flang][Runtime] Fix implicit conversion warning when targeting 32bit… (#99465)

… architecture

On 32 bit systems, TypeParameterValue is 64bit wide while CFI_index_t is
32bit wide.

Added: 
    

Modified: 
    flang/runtime/derived.cpp

Removed: 
    


################################################################################
diff  --git a/flang/runtime/derived.cpp b/flang/runtime/derived.cpp
index 0d9e033df4e27..659f54fa344bb 100644
--- a/flang/runtime/derived.cpp
+++ b/flang/runtime/derived.cpp
@@ -23,10 +23,9 @@ static RT_API_ATTRS void GetComponentExtents(SubscriptValue (&extents)[maxRank],
     const typeInfo::Component &comp, const Descriptor &derivedInstance) {
   const typeInfo::Value *bounds{comp.bounds()};
   for (int dim{0}; dim < comp.rank(); ++dim) {
-    SubscriptValue lb{bounds[2 * dim].GetValue(&derivedInstance).value_or(0)};
-    SubscriptValue ub{
-        bounds[2 * dim + 1].GetValue(&derivedInstance).value_or(0)};
-    extents[dim] = ub >= lb ? ub - lb + 1 : 0;
+    auto lb{bounds[2 * dim].GetValue(&derivedInstance).value_or(0)};
+    auto ub{bounds[2 * dim + 1].GetValue(&derivedInstance).value_or(0)};
+    extents[dim] = ub >= lb ? static_cast<SubscriptValue>(ub - lb + 1) : 0;
   }
 }
 


        


More information about the flang-commits mailing list