r310994 - Fix a UBSan failure where this boolean was copied when uninitialized.

Chandler Carruth via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 16 00:22:49 PDT 2017


Author: chandlerc
Date: Wed Aug 16 00:22:49 2017
New Revision: 310994

URL: http://llvm.org/viewvc/llvm-project?rev=310994&view=rev
Log:
Fix a UBSan failure where this boolean was copied when uninitialized.

When r310905 moved the pointer and bool out of a PointerIntPair, it made
them end up uninitialized and caused UBSan failures when copying the
uninitialized boolean. However, making the pointer be null should avoid
the reference to the boolean entirely.

Modified:
    cfe/trunk/lib/AST/ExprConstant.cpp

Modified: cfe/trunk/lib/AST/ExprConstant.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ExprConstant.cpp?rev=310994&r1=310993&r2=310994&view=diff
==============================================================================
--- cfe/trunk/lib/AST/ExprConstant.cpp (original)
+++ cfe/trunk/lib/AST/ExprConstant.cpp Wed Aug 16 00:22:49 2017
@@ -977,7 +977,7 @@ namespace {
   /// RAII object used to optionally suppress diagnostics and side-effects from
   /// a speculative evaluation.
   class SpeculativeEvaluationRAII {
-    EvalInfo *Info;
+    EvalInfo *Info = nullptr;
     Expr::EvalStatus OldStatus;
     bool OldIsSpeculativelyEvaluating;
 




More information about the cfe-commits mailing list