[flang-commits] [flang] 71d4a55 - [flang] Fix flang GCC Buildbot broken by D130731

Markus Böck via flang-commits flang-commits at lists.llvm.org
Mon Aug 1 13:15:53 PDT 2022


Author: Markus Böck
Date: 2022-08-01T22:15:45+02:00
New Revision: 71d4a5502f76ccf3b37816628a2300937fafd90b

URL: https://github.com/llvm/llvm-project/commit/71d4a5502f76ccf3b37816628a2300937fafd90b
DIFF: https://github.com/llvm/llvm-project/commit/71d4a5502f76ccf3b37816628a2300937fafd90b.diff

LOG: [flang] Fix flang GCC Buildbot broken by D130731

GCC and that specific build bot issued warnings turned errors, due to a narrowing conversion from `unsigned` to `int32_t`. Silence these via a static_cast.

Added: 
    

Modified: 
    flang/lib/Optimizer/CodeGen/CodeGen.cpp

Removed: 
    


################################################################################
diff  --git a/flang/lib/Optimizer/CodeGen/CodeGen.cpp b/flang/lib/Optimizer/CodeGen/CodeGen.cpp
index 94ced070adcae..ed4b71b13fe68 100644
--- a/flang/lib/Optimizer/CodeGen/CodeGen.cpp
+++ b/flang/lib/Optimizer/CodeGen/CodeGen.cpp
@@ -143,7 +143,9 @@ class FIROpConversion : public mlir::ConvertOpToLLVMPattern<FromOp> {
                               unsigned boxValue) const {
     auto pty = mlir::LLVM::LLVMPointerType::get(resultTy);
     auto p = rewriter.create<mlir::LLVM::GEPOp>(
-        loc, pty, box, llvm::ArrayRef<mlir::LLVM::GEPArg>{0, boxValue});
+        loc, pty, box,
+        llvm::ArrayRef<mlir::LLVM::GEPArg>{
+            0, static_cast<std::int32_t>(boxValue)});
     return rewriter.create<mlir::LLVM::LoadOp>(loc, resultTy, p);
   }
 
@@ -185,7 +187,8 @@ class FIROpConversion : public mlir::ConvertOpToLLVMPattern<FromOp> {
   loadBaseAddrFromBox(mlir::Location loc, mlir::Type ty, mlir::Value box,
                       mlir::ConversionPatternRewriter &rewriter) const {
     auto pty = mlir::LLVM::LLVMPointerType::get(ty);
-    mlir::LLVM::GEPOp p = genGEP(loc, pty, rewriter, box, 0, kAddrPosInBox);
+    mlir::LLVM::GEPOp p = genGEP(loc, pty, rewriter, box, 0,
+                                 static_cast<std::int32_t>(kAddrPosInBox));
     return rewriter.create<mlir::LLVM::LoadOp>(loc, ty, p);
   }
 
@@ -193,7 +196,8 @@ class FIROpConversion : public mlir::ConvertOpToLLVMPattern<FromOp> {
   loadElementSizeFromBox(mlir::Location loc, mlir::Type ty, mlir::Value box,
                          mlir::ConversionPatternRewriter &rewriter) const {
     auto pty = mlir::LLVM::LLVMPointerType::get(ty);
-    mlir::LLVM::GEPOp p = genGEP(loc, pty, rewriter, box, 0, kElemLenPosInBox);
+    mlir::LLVM::GEPOp p = genGEP(loc, pty, rewriter, box, 0,
+                                 static_cast<std::int32_t>(kElemLenPosInBox));
     return rewriter.create<mlir::LLVM::LoadOp>(loc, ty, p);
   }
 


        


More information about the flang-commits mailing list