r311070 - Fix undefined behavior that is caused by not always initializing a bool.

Daniel Jasper via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 16 23:33:46 PDT 2017


Author: djasper
Date: Wed Aug 16 23:33:46 2017
New Revision: 311070

URL: http://llvm.org/viewvc/llvm-project?rev=311070&view=rev
Log:
Fix undefined behavior that is caused by not always initializing a bool.

The fix in r310994 is incomplete, as moveFromAndCancel can set the
pointer without initializing OldIsSpeculativelyEvaluating.

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=311070&r1=311069&r2=311070&view=diff
==============================================================================
--- cfe/trunk/lib/AST/ExprConstant.cpp (original)
+++ cfe/trunk/lib/AST/ExprConstant.cpp Wed Aug 16 23:33:46 2017
@@ -984,6 +984,7 @@ namespace {
     void moveFromAndCancel(SpeculativeEvaluationRAII &&Other) {
       Info = Other.Info;
       OldStatus = Other.OldStatus;
+      OldIsSpeculativelyEvaluating = Other.OldIsSpeculativelyEvaluating;
       Other.Info = nullptr;
     }
 




More information about the cfe-commits mailing list