LLVM Bugzilla is read-only and represents the historical archive of all LLVM issues filled before November 26, 2021. Use github to submit LLVM bugs

Bug 10462 - JumpScopeChecker crash on invalid
Summary: JumpScopeChecker crash on invalid
Status: RESOLVED FIXED
Alias: None
Product: clang
Classification: Unclassified
Component: C++ (show other bugs)
Version: unspecified
Hardware: PC All
: P normal
Assignee: Unassigned Clang Bugs
URL:
Keywords: crash-on-invalid
Depends on:
Blocks:
 
Reported: 2011-07-24 14:12 PDT by Chris Lattner
Modified: 2011-07-28 20:27 PDT (History)
5 users (show)

See Also:
Fixed By Commit(s):


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Lattner 2011-07-24 14:12:37 PDT
Clang crashes on:

$ cat foo.cpp
enum MyEnum {
  something_valid,
  something_invalid
};

bool recurse() {
  MyEnum K;
  switch (K) {
  case something_valid:
  case what_am_i_thinking:
    int *X = 0;
    if (recurse()) {
    }

    break;
  }
}

$ clang foo.cpp -w
x.cpp:11:8: error: use of undeclared identifier 'what_am_i_thinking'
  case what_am_i_thinking:
       ^
Assertion failed: (LabelAndGotoScopes.count(SC) && "Case not visited?"), function VerifyJumps, file JumpDiagnostics.cpp, line 494.
0  clang             0x0000000101f7b0d5 PrintStackTrace(void*) + 53
1  clang             0x0000000101f7b78b SignalHandler(int) + 379
2  libSystem.B.dylib 0x00007fff86fba1ba _sigtramp + 26
3  libSystem.B.dylib 0x000100010044075c _sigtramp + 2034787772
4  clang             0x0000000101f7b45b raise + 27
5  clang             0x0000000101f7b51a abort + 26
6  clang             0x0000000101f7b4f4 __assert_rtn + 132
7  clang             0x0000000100429b6c (anonymous namespace)::JumpScopeChecker::VerifyJumps() + 492
8  clang             0x00000001004289e7 (anonymous namespace)::JumpScopeChecker::JumpScopeChecker(clang::Stmt*, clang::Sema&) + 263
9  clang             0x0000000100428715 (anonymous namespace)::JumpScopeChecker::JumpScopeChecker(clang::Stmt*, clang::Sema&) + 37
10 clang             0x00000001004286d1 clang::Sema::DiagnoseInvalidJumps(clang::Stmt*) + 49
...
Comment 1 Ted Kremenek 2011-07-27 16:01:31 PDT
cloned to <rdar://problem/9852007>
Comment 2 Argyrios Kyrtzidis 2011-07-28 20:27:56 PDT
r136447.