[Mlir-commits] [mlir] 9ea3fcf - Fix use of unitialized variable 'mapperFunc' to prevent unexpected behaviour.

Akash Banerjee llvmlistbot at llvm.org
Sat Apr 22 02:51:24 PDT 2023


Author: Akash Banerjee
Date: 2023-04-22T10:50:35+01:00
New Revision: 9ea3fcfa380c6097fddd0d9a9b2c13f0f20bc41a

URL: https://github.com/llvm/llvm-project/commit/9ea3fcfa380c6097fddd0d9a9b2c13f0f20bc41a
DIFF: https://github.com/llvm/llvm-project/commit/9ea3fcfa380c6097fddd0d9a9b2c13f0f20bc41a.diff

LOG: Fix use of unitialized variable 'mapperFunc' to prevent unexpected behaviour.

Added: 
    

Modified: 
    mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp b/mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp
index 4d9c54100a2cb..80cc92f97772f 100644
--- a/mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp
+++ b/mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp
@@ -1421,7 +1421,7 @@ static LogicalResult
 convertOmpTargetData(Operation *op, llvm::IRBuilderBase &builder,
                      LLVM::ModuleTranslation &moduleTranslation) {
   unsigned numMapOperands;
-  bool mapperFunc;
+  bool mapperFunc = false;
   llvm::Value *ifCond = nullptr;
   int64_t deviceID = llvm::omp::OMP_DEVICEID_UNDEF;
   SmallVector<Value> mapOperands;
@@ -1488,7 +1488,6 @@ convertOmpTargetData(Operation *op, llvm::IRBuilderBase &builder,
             numMapOperands = exitDataOp.getMapOperands().size();
             mapOperands = exitDataOp.getMapOperands();
             mapTypes = exitDataOp.getMapTypes();
-            mapperFunc = false;
             return success();
           })
           .Default([&](Operation *op) {


        


More information about the Mlir-commits mailing list