[LLVMbugs] [Bug 11294] New: Expr.h:1311: llvm::StringRef clang::StringLiteral::getString() const: Assertion `CharByteWidth==1 && "This function is used in places that assume strings use char"' failed.

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Nov 2 00:55:00 PDT 2011


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

             Bug #: 11294
           Summary: Expr.h:1311: llvm::StringRef
                    clang::StringLiteral::getString() const: Assertion
                    `CharByteWidth==1 && "This function is used in places
                    that assume strings use char"' failed.
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Static Analyzer
        AssignedTo: kremenek at apple.com
        ReportedBy: dimhen at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified


$ clang -v
clang version 3.1 (trunk 143530)
Target: x86_64-unknown-linux-gnu
Thread model: posix

compiled F15 native gcc-4.6.1, optimized build

$ cat tst_wchar.c 
typedef int wchar_t;
struct s {
    wchar_t *name;
};

void baz (struct s* p);

void baz (struct s* p)
{
    p->name = L"a";
}

$ clang -cc1 -analyze -analyzer-checker=core tst_wchar.c 
clang:
/home/dim/src/llvm/tools/clang/lib/StaticAnalyzer/Core/../../../include/clang/AST/Expr.h:1311:
llvm::StringRef clang::StringLiteral::getString() const: Assertion
`CharByteWidth==1 && "This function is used in places that assume strings use
char"' failed.
0  clang           0x00000000019963af
1  clang           0x0000000001996899
2  libpthread.so.0 0x00000035a4e0eef0
3  libc.so.6       0x00000035a4a352d5 gsignal + 53
4  libc.so.6       0x00000035a4a36beb abort + 379
5  libc.so.6       0x00000035a4a2dc5e
6  libc.so.6       0x00000035a4a2dd02
7  clang           0x0000000000dbe867
8  clang           0x0000000000dbf1bb
9  clang           0x0000000000da6a69
clang::ento::ProgramState::getSValAsScalarOrLoc(clang::ento::MemRegion const*)
const + 153
10 clang           0x0000000000da9796
clang::ento::ScanReachableSymbols::scan(clang::ento::MemRegion const*) + 246
11 clang           0x0000000000da9ab8
clang::ento::ScanReachableSymbols::scan(clang::ento::SVal) + 152
12 clang           0x0000000000d6eebd
clang::ento::EnvironmentManager::removeDeadBindings(clang::ento::Environment,
clang::ento::SymbolReaper&, clang::ento::ProgramState const*) + 3213
13 clang           0x0000000000dabf6a
clang::ento::ProgramStateManager::removeDeadBindings(clang::ento::ProgramState
const*, clang::StackFrameContext const*, clang::ento::SymbolReaper&) + 74
14 clang           0x0000000000d80a46
clang::ento::ExprEngine::ProcessStmt(clang::CFGStmt,
clang::ento::ExplodedNode*) + 502
15 clang           0x0000000000d8197a
clang::ento::ExprEngine::processCFGElement(clang::CFGElement,
clang::ento::ExplodedNode*, unsigned int, clang::ento::NodeBuilderContext*) +
202
16 clang           0x0000000000d6a121
clang::ento::CoreEngine::HandlePostStmt(clang::CFGBlock const*, unsigned int,
clang::ento::ExplodedNode*) + 145
17 clang           0x0000000000d6b36d
clang::ento::CoreEngine::ExecuteWorkList(clang::LocationContext const*,
unsigned int, clang::ento::ProgramState const*) + 733
18 clang           0x0000000000c8d2d6
19 clang           0x0000000000c8dc95
20 clang           0x0000000000c8e1bc
21 clang           0x0000000000c8ecfe
22 clang           0x000000000097ecaf clang::ParseAST(clang::Sema&, bool) + 415
23 clang           0x0000000000719835
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 373
24 clang           0x00000000006ff756
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 1174
25 clang           0x00000000006f5b17 cc1_main(char const**, char const**, char
const*, void*) + 535
26 clang           0x00000000006e9c84 main + 708
27 libc.so.6       0x00000035a4a2139d __libc_start_main + 237
28 clang           0x00000000006f577d
Stack dump:
0.    Program arguments: clang -cc1 -analyze -analyzer-checker=core tst_wchar.c 
1.    <eof> parser at end of file
2.    tst_wchar.c:10:5: Error evaluating statement
Aborted (core dumped)

-- 
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