r345477 - [AST] Fix an use-of-uninitialized bug introduced in CaseStmt

Bruno Ricci via cfe-commits cfe-commits at lists.llvm.org
Sun Oct 28 07:14:06 PDT 2018


Author: brunoricci
Date: Sun Oct 28 07:14:06 2018
New Revision: 345477

URL: http://llvm.org/viewvc/llvm-project?rev=345477&view=rev
Log:
[AST] Fix an use-of-uninitialized bug introduced in CaseStmt

SwitchCaseBits.CaseStmtIsGNURange needs to be initialized first.


Modified:
    cfe/trunk/include/clang/AST/Stmt.h

Modified: cfe/trunk/include/clang/AST/Stmt.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Stmt.h?rev=345477&r1=345476&r2=345477&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/Stmt.h (original)
+++ cfe/trunk/include/clang/AST/Stmt.h Sun Oct 28 07:14:06 2018
@@ -975,11 +975,11 @@ class CaseStmt final
   CaseStmt(Expr *lhs, Expr *rhs, SourceLocation caseLoc,
            SourceLocation ellipsisLoc, SourceLocation colonLoc)
       : SwitchCase(CaseStmtClass, caseLoc, colonLoc) {
-    setLHS(lhs);
-    setSubStmt(nullptr);
     // Handle GNU case statements of the form LHS ... RHS.
     bool IsGNURange = rhs != nullptr;
     SwitchCaseBits.CaseStmtIsGNURange = IsGNURange;
+    setLHS(lhs);
+    setSubStmt(nullptr);
     if (IsGNURange) {
       setRHS(rhs);
       setEllipsisLoc(ellipsisLoc);




More information about the cfe-commits mailing list