[clang] 5b3f41c - [analyzer][NFC] Workaround miscompilation on recent MSVC

via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 30 02:15:38 PDT 2023


Author: dingfei
Date: 2023-08-30T17:14:38+08:00
New Revision: 5b3f41c55d9261dcb682d60a4258fa2c30fd50c8

URL: https://github.com/llvm/llvm-project/commit/5b3f41c55d9261dcb682d60a4258fa2c30fd50c8
DIFF: https://github.com/llvm/llvm-project/commit/5b3f41c55d9261dcb682d60a4258fa2c30fd50c8.diff

LOG: [analyzer][NFC] Workaround miscompilation on recent MSVC

SVal argument 'Cond' passed in is corrupted in release mode with
exception handling enabled (result in an UndefinedSVal), or changing
lambda capture inside the callee can workaround this.

Known problematic VS Versions:
- VS 2022 17.4.4
- VS 2022 17.5.4
- VS 2022 17.7.2

Verified working VS Version:
- VS 2019 16.11.25

Fixes https://github.com/llvm/llvm-project/issues/62130

Reviewed By: steakhal

Differential Revision: https://reviews.llvm.org/D159163

Added: 
    

Modified: 
    clang/lib/StaticAnalyzer/Core/ConstraintManager.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/StaticAnalyzer/Core/ConstraintManager.cpp b/clang/lib/StaticAnalyzer/Core/ConstraintManager.cpp
index 9ef3455a110a84..c0b3f346b654df 100644
--- a/clang/lib/StaticAnalyzer/Core/ConstraintManager.cpp
+++ b/clang/lib/StaticAnalyzer/Core/ConstraintManager.cpp
@@ -91,7 +91,7 @@ ConstraintManager::assumeDualImpl(ProgramStateRef &State,
 
 ConstraintManager::ProgramStatePair
 ConstraintManager::assumeDual(ProgramStateRef State, DefinedSVal Cond) {
-  auto AssumeFun = [&](bool Assumption) {
+  auto AssumeFun = [&, Cond](bool Assumption) {
     return assumeInternal(State, Cond, Assumption);
   };
   return assumeDualImpl(State, AssumeFun);


        


More information about the cfe-commits mailing list