diff options
author | Alexander Kornienko <alexfh@google.com> | 2013-02-01 15:39:20 +0000 |
---|---|---|
committer | Alexander Kornienko <alexfh@google.com> | 2013-02-01 15:39:20 +0000 |
commit | 0162b832fd6450cd3a23019a3c900382d0e9415c (patch) | |
tree | 86f0bc941228fbe676a586bc69c7db7de03586b4 | |
parent | 57dab7135269ba12b979a91415153d00794c7727 (diff) |
Fixed segmentation fault when a CFGBlock has NULL successor.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174182 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Sema/AnalysisBasedWarnings.cpp | 2 | ||||
-rw-r--r-- | test/SemaCXX/switch-implicit-fallthrough.cpp | 5 |
2 files changed, 6 insertions, 1 deletions
diff --git a/lib/Sema/AnalysisBasedWarnings.cpp b/lib/Sema/AnalysisBasedWarnings.cpp index b362239163..5443edb191 100644 --- a/lib/Sema/AnalysisBasedWarnings.cpp +++ b/lib/Sema/AnalysisBasedWarnings.cpp @@ -714,7 +714,7 @@ namespace { for (CFGBlock::const_succ_iterator I = P->succ_begin(), E = P->succ_end(); I != E; ++I) { - if (ReachableBlocks.insert(*I)) + if (*I && ReachableBlocks.insert(*I)) BlockQueue.push_back(*I); } } diff --git a/test/SemaCXX/switch-implicit-fallthrough.cpp b/test/SemaCXX/switch-implicit-fallthrough.cpp index 912b21ebfd..bc94c9e750 100644 --- a/test/SemaCXX/switch-implicit-fallthrough.cpp +++ b/test/SemaCXX/switch-implicit-fallthrough.cpp @@ -172,6 +172,11 @@ int fallthrough_macro1(int n) { return n; } +void fallthrough_cfgblock_with_null_successor(int x) { + (x && "") ? (void)(0) : (void)(1); + switch (x) {} +} + int fallthrough_position(int n) { switch (n) { [[clang::fallthrough]]; // expected-warning{{fallthrough annotation in unreachable code}} |