diff --git a/clang/lib/Analysis/CFG.cpp b/clang/lib/Analysis/CFG.cpp --- a/clang/lib/Analysis/CFG.cpp +++ b/clang/lib/Analysis/CFG.cpp @@ -3356,7 +3356,7 @@ // Save "Succ" in BackpatchBlocks. In the backpatch processing, "Succ" is // used to avoid adding "Succ" again. BackpatchBlocks.push_back(JumpSource(Succ, ScopePos)); - return Block; + return VisitChildren(G); } CFGBlock *CFGBuilder::VisitForStmt(ForStmt *F) { diff --git a/clang/lib/Analysis/UninitializedValues.cpp b/clang/lib/Analysis/UninitializedValues.cpp --- a/clang/lib/Analysis/UninitializedValues.cpp +++ b/clang/lib/Analysis/UninitializedValues.cpp @@ -820,10 +820,10 @@ Ex = stripCasts(C, UO->getSubExpr()); if (const VarDecl *VD = findVar(Ex).getDecl()) - if (vals[VD] != Initialized) - // If the variable isn't initialized by the time we get here, then we - // mark it as potentially uninitialized for those cases where it's used - // on an indirect path, where it's not guaranteed to be defined. + if (vals[VD] == Initialized) + // If the variable is initialized by the time we get here, then we mark + // it as potentially uninitialized for those cases where it's used on + // an indirect path, where it's not guaranteed to be defined. vals[VD] = MayUninitialized; } } diff --git a/clang/test/Analysis/asm-goto.cpp b/clang/test/Analysis/asm-goto.cpp --- a/clang/test/Analysis/asm-goto.cpp +++ b/clang/test/Analysis/asm-goto.cpp @@ -1,5 +1,5 @@ -// RUN: %clang_analyze_cc1 -triple i386-pc-linux-gnu -analyzer-checker=debug.DumpCFG %s 2>&1 | FileCheck %s -// RUN: %clang_analyze_cc1 -triple x86_64-pc-linux-gnu -analyzer-checker=debug.DumpCFG %s 2>&1 | FileCheck %s +// RUN: %clang_analyze_cc1 -triple i386-pc-linux-gnu -analyzer-checker=debug.DumpCFG %s 2>&1 | FileCheck %s +// RUN: %clang_analyze_cc1 -triple x86_64-pc-linux-gnu -analyzer-checker=debug.DumpCFG %s 2>&1 | FileCheck %s int foo(int cond) { @@ -17,11 +17,12 @@ // CHECK-NEXT: Succs (1): B0 // CHECK-LABEL: label_true -// CHECK-NEXT: asm goto +// CHECK-NEXT: cond +// CHECK-NEXT: [B3.1] +// CHECK-NEXT: T: asm goto // CHECK-NEXT: Preds (2): B3 B4 // CHECK-NEXT: Succs (3): B2 B3 B1 - int bar(int cond) { asm goto("testl %0, %0; jne %l1;" :: "r"(cond)::L1, L2); @@ -32,7 +33,9 @@ } // CHECK: [B4] -// CHECK-NEXT: asm goto +// CHECK-NEXT: cond +// CHECK-NEXT: [B4.1] +// CHECK-NEXT: T: asm goto // CHECK-NEXT: Preds (1): B5 // CHECK-NEXT: Succs (3): B3 B2 B1 @@ -48,6 +51,20 @@ } // CHECK-LABEL: A1 -// CHECK-NEXT: asm goto +// CHECK-NEXT: n +// CHECK-NEXT: [B4.1] +// CHECK-NEXT: T: asm goto // CHECK-NEXT: Preds (2): B5 B4 // CHECK-NEXT: Succs (5): B3 B4 B2 B1 B5 + +void baz(void) +{ + asm goto("" :: "r"(1 ? 2 : 0 << -1) :: error); +error:; +} + +// CHECK: [B2] +// CHECK-NEXT: 1: [B5.2] ? [B3.1] : [B4.4] +// CHECK-NEXT: T: asm goto ("" : : "r" ([B2.1]) : : error); +// CHECK-NEXT: Preds (2): B3 B4 +// CHECK-NEXT: Succs (1): B1