[LLVMbugs] [Bug 13440] New: Casting.h|194| llvm::cast_retty<To, From>::ret_type llvm::cast(const clang::QualType &): Assertion `isa<X>(Val) && "cast<Ty>() argument of incompatible type!"' failed.

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Jul 23 13:56:01 PDT 2012


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

             Bug #: 13440
           Summary: Casting.h|194| llvm::cast_retty<To, From>::ret_type
                    llvm::cast(const clang::QualType &): Assertion
                    `isa<X>(Val) && "cast<Ty>() argument of incompatible
                    type!"' failed.
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Static Analyzer
        AssignedTo: kremenek at apple.com
        ReportedBy: jepler at dsndata.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified


When the following small program is compiled with 'scan-build c++-analyzer -c'
it fails with the assertion error shown in the summary.

Version is clang version 3.2 (trunk) (r160634) on 64-bit Ubuntu 8.04.

There are some other reports regarding this assertion in bugzilla, but none of
them seem to have what looks like the salient detail in my test program, a
reference to a typedef'd array.  

typedef int T[1];
struct S {
    S(T &x) : x(x) {}
    int *m() { return x; }
    T &x;
};

$ scan-build c++-analyzer minimized2.cc
scan-build: 'clang' executable not found in
'/src/jepler/clang-trunk/llvm/tools/clang/tools/scan-build/bin'.
scan-build: Using 'clang' from path: /src/jepler/clang-trunk/bin/clang
clang++: /src/jepler/clang-trunk/llvm/include/llvm/Support/Casting.h:194:
typename llvm::cast_retty<To, From>::ret_type llvm::cast(const Y&) [with X =
clang::ArrayType, Y = clang::QualType]: Assertion `isa<X>(Val) && "cast<Ty>()
argument of incompatible type!"' failed.
0  clang++         0x000000000251431f
1  clang++         0x00000000025150a9
2  libpthread.so.0 0x00007ffc2dc017d0
3  libc.so.6       0x00007ffc2cf25095 gsignal + 53
4  libc.so.6       0x00007ffc2cf26af0 abort + 272
5  libc.so.6       0x00007ffc2cf1e2df __assert_fail + 239
6  clang++         0x0000000001139883
7  clang++         0x000000000114d7b3
clang::ento::SValBuilder::evalCast(clang::ento::SVal, clang::QualType,
clang::QualType) + 1475
8  clang++         0x00000000010f95e6
clang::ento::ExprEngine::VisitCast(clang::CastExpr const*, clang::Expr const*,
clang::ento::ExplodedNode*, clang::ento::ExplodedNodeSet&) + 3206
9  clang++         0x00000000010f055c
clang::ento::ExprEngine::Visit(clang::Stmt const*, clang::ento::ExplodedNode*,
clang::ento::ExplodedNodeSet&) + 10428
10 clang++         0x00000000010f17e9
clang::ento::ExprEngine::ProcessStmt(clang::CFGStmt,
clang::ento::ExplodedNode*) + 649
11 clang++         0x00000000010f1ac1
clang::ento::ExprEngine::processCFGElement(clang::CFGElement,
clang::ento::ExplodedNode*, unsigned int, clang::ento::NodeBuilderContext*) +
209
12 clang++         0x00000000010d6560
clang::ento::CoreEngine::HandlePostStmt(clang::CFGBlock const*, unsigned int,
clang::ento::ExplodedNode*) + 144
13 clang++         0x00000000010d67a8
clang::ento::CoreEngine::dispatchWorkItem(clang::ento::ExplodedNode*,
clang::ProgramPoint, clang::ento::WorkListUnit const&) + 136
14 clang++         0x00000000010d7222
clang::ento::CoreEngine::ExecuteWorkList(clang::LocationContext const*,
unsigned int, llvm::IntrusiveRefCntPtr<clang::ento::ProgramState const>) + 210
15 clang++         0x0000000000f7a581
16 clang++         0x0000000000f7b14a
17 clang++         0x0000000000f7c85d
18 clang++         0x0000000000f8f28d
19 clang++         0x0000000000a4503b clang::ParseAST(clang::Sema&, bool, bool)
+ 395
20 clang++         0x00000000006da931 clang::FrontendAction::Execute() + 145
21 clang++         0x00000000006afecc
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 348
22 clang++         0x000000000068cd77
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 1575
23 clang++         0x0000000000681ecd cc1_main(char const**, char const**, char
const*, void*) + 1053
24 clang++         0x000000000068b765 main + 4309
25 libc.so.6       0x00007ffc2cf111c4 __libc_start_main + 244
26 clang++         0x00000000006805f9
Stack dump:
0.    Program arguments: /src/jepler/clang-trunk/bin/clang++ -cc1 -triple
x86_64-unknown-linux-gnu -analyze -disable-free -main-file-name minimize2.cc
-analyzer-store=region -analyzer-opt-analyze-nested-blocks
-analyzer-eagerly-assume -analyzer-ipa=inlining -analyzer-checker=core
-analyzer-checker=unix -analyzer-checker=deadcode
-analyzer-checker=security.insecureAPI.UncheckedReturn
-analyzer-checker=security.insecureAPI.getpw
-analyzer-checker=security.insecureAPI.gets
-analyzer-checker=security.insecureAPI.mktemp
-analyzer-checker=security.insecureAPI.mkstemp
-analyzer-checker=security.insecureAPI.vfork -analyzer-output plist -w
-mrelocation-model static -mdisable-fp-elim -fmath-errno -masm-verbose
-mconstructor-aliases -munwind-tables -target-cpu x86-64 -target-linker-version
2.18.0.20080103 -momit-leaf-frame-pointer -resource-dir
/src/jepler/clang-trunk/bin/../lib/clang/3.2 -fmodule-cache-path
/var/tmp/clang-module-cache -internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/4.2/../../../../include/c++/4.2 -internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/4.2/../../../../include/c++/4.2/x86_64-linux-gnu
-internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/4.2/../../../../include/c++/4.2/backward
-internal-isystem /usr/local/include -internal-isystem
/src/jepler/clang-trunk/bin/../lib/clang/3.2/include -internal-externc-isystem
/include -internal-externc-isystem /usr/include -fdeprecated-macro
-fdebug-compilation-dir /src/jepler/sds2 -ferror-limit 19 -fmessage-length 0
-mstackrealign -fobjc-runtime=gcc -fcxx-exceptions -fexceptions
-fdiagnostics-show-option -analyzer-output=html -o
/tmp/scan-build-2012-07-23-19 -x c++ minimize2.cc 
1.    <eof> parser at end of file
2.    minimize2.cc:4:23: Error evaluating statement
3.    minimize2.cc:4:23: Error evaluating statement

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