[LLVMbugs] [Bug 8722] New: 'clang --analyze' crashes on casting from an object L-value to a reference

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Dec 1 22:51:07 PST 2010


http://llvm.org/bugs/show_bug.cgi?id=8722

           Summary: 'clang --analyze' crashes on casting from an object
                    L-value to a reference
           Product: clang
           Version: trunk
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Static Analyzer
        AssignedTo: kremenek at apple.com
        ReportedBy: zhanyong.wan at gmail.com
                CC: llvmbugs at cs.uiuc.edu


$ cat test.cc
class Foo {};

void Test() {
  int n;
  reinterpret_cast<const char&>(n);    // fine

  Foo foo;
  reinterpret_cast<const char&>(foo);  // crashes 'clang --analyze'
}

$ clang --analyze test.cc

0  clang           0x00000000012e1910
1  clang           0x00000000012e1e1a
2  libpthread.so.0 0x00002b34758db9f0
3  clang           0x00000000006fca52
clang::StoreManager::CastRegion(clang::MemRegion const*, clang::QualType) + 322
4  clang           0x0000000000700904 clang::SValuator::EvalCast(clang::SVal,
clang::QualType, clang::QualType) + 1364
5  clang           0x0000000000774d7e
clang::GRExprEngine::VisitCast(clang::CastExpr const*, clang::Expr const*,
clang::ExplodedNode*, clang::ExplodedNodeSet&, bool) + 1438
6  clang           0x0000000000769443 clang::GRExprEngine::Visit(clang::Stmt
const*, clang::ExplodedNode*, clang::ExplodedNodeSet&) + 819
7  clang           0x0000000000774949
clang::GRExprEngine::VisitCast(clang::CastExpr const*, clang::Expr const*,
clang::ExplodedNode*, clang::ExplodedNodeSet&, bool) + 361
8  clang           0x0000000000769443 clang::GRExprEngine::Visit(clang::Stmt
const*, clang::ExplodedNode*, clang::ExplodedNodeSet&) + 819
9  clang           0x00000000007754ae
clang::GRExprEngine::ProcessStmt(clang::CFGStmt, clang::GRStmtNodeBuilder&) +
798
10 clang           0x0000000000775b19
clang::GRExprEngine::ProcessElement(clang::CFGElement,
clang::GRStmtNodeBuilder&) + 121
11 clang           0x000000000074eca4
clang::GRCoreEngine::ExecuteWorkList(clang::LocationContext const*, unsigned
int, clang::GRState const*) + 500
12 clang           0x00000000006af6f2
13 clang           0x00000000006b1666
14 clang           0x00000000008c84ed clang::ParseAST(clang::Sema&, bool) + 557
15 clang           0x00000000007eec9b
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 315
16 clang           0x000000000056e18d
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 989
17 clang           0x0000000000568886 cc1_main(char const**, char const**, char
const*, void*) + 982
18 clang           0x000000000056d3b7 main + 3639
19 libc.so.6       0x00002b3476033d5d __libc_start_main + 253
20 clang           0x00000000005659fe
Stack dump:
0.    Program arguments: clang -cc1 ... test.cc
1.    <eof> parser at end of file
2.    test.cc:8:3: Error evaluating statement
3.    test.cc:8:3: Error evaluating statement
4.    test.cc:8:9: Error evaluating statement
clang: error: unable to execute command: Segmentation fault
clang: error: clang frontend command failed due to signal 1 (use -v to see
invocation)

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list