[LLVMbugs] [Bug 13290] New: clang complains about an assertion in a cast and crashes

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sat Jul 7 13:58:19 PDT 2012


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

             Bug #: 13290
           Summary: clang complains about an assertion in a cast and
                    crashes
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Frontend
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: DeusExSophismata at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified


clang: /home/david/data/llvm/include/llvm/Support/Casting.h:194: typename
llvm::cast_retty<To, From>::ret_type llvm::cast(const Y&) [with X =
clang::RecordType; Y = clang::QualType; typename llvm::cast_retty<To,
From>::ret_type = const clang::RecordType*]: Assertion `isa<X>(Val) &&
"cast<Ty>() argument of incompatible type!"' failed.
0  clang           0x0000000001df390f
1  clang           0x0000000001df3dc9
2  libpthread.so.0 0x000000368e20efe0
3  libc.so.6       0x000000368de35965 gsignal + 53
4  libc.so.6       0x000000368de37118 abort + 328
5  libc.so.6       0x000000368de2e6e2
6  libc.so.6       0x000000368de2e792
7  clang           0x0000000000865c29
8  clang           0x00000000010c9fd3
9  clang           0x00000000010ca18a
10 clang           0x00000000010ca18a
11 clang           0x00000000010dc9ce
clang::Expr::EvaluateAsInitializer(clang::APValue&, clang::ASTContext const&,
clang::VarDecl const*, llvm::SmallVectorImpl<std::pair<clang::SourceLocation,
clang::PartialDiagnostic> >&) const + 638
12 clang           0x00000000010779b6
clang::VarDecl::evaluateValue(llvm::SmallVectorImpl<std::pair<clang::SourceLocation,
clang::PartialDiagnostic> >&) const + 214
13 clang           0x0000000001077ac7 clang::VarDecl::evaluateValue() const +
55
14 clang           0x0000000000932809
clang::CodeGen::CodeGenModule::EmitConstantInit(clang::VarDecl const&,
clang::CodeGen::CodeGenFunction*) + 41
15 clang           0x00000000008f4293
clang::CodeGen::CodeGenFunction::AddInitializerToStaticVarDecl(clang::VarDecl
const&, llvm::GlobalVariable*) + 35
16 clang           0x00000000008f8076
clang::CodeGen::CodeGenFunction::EmitStaticVarDecl(clang::VarDecl const&,
llvm::GlobalValue::LinkageTypes) + 1798
17 clang           0x000000000098ce27
clang::CodeGen::CodeGenFunction::EmitDeclStmt(clang::DeclStmt const&) + 71
18 clang           0x0000000000993c65
clang::CodeGen::CodeGenFunction::EmitSimpleStmt(clang::Stmt const*) + 277
19 clang           0x0000000000991287
clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt const*) + 39
20 clang           0x000000000099174f
clang::CodeGen::CodeGenFunction::EmitCompoundStmt(clang::CompoundStmt const&,
bool, clang::CodeGen::AggValueSlot) + 239
21 clang           0x0000000000993c40
clang::CodeGen::CodeGenFunction::EmitSimpleStmt(clang::Stmt const*) + 240
22 clang           0x0000000000991287
clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt const*) + 39
23 clang           0x00000000009a47a6
clang::CodeGen::CodeGenFunction::GenerateCode(clang::GlobalDecl,
llvm::Function*, clang::CodeGen::CGFunctionInfo const&) + 486
24 clang           0x00000000008a28e6
clang::CodeGen::CodeGenModule::EmitGlobalFunctionDefinition(clang::GlobalDecl)
+ 1142
25 clang           0x00000000008a508b
clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl) + 411
26 clang           0x00000000008a5419
clang::CodeGen::CodeGenModule::EmitDeferred() + 201
27 clang           0x00000000008a5449 clang::CodeGen::CodeGenModule::Release()
+ 9
28 clang           0x000000000088e2fb
29 clang           0x00000000009bdb1a clang::ParseAST(clang::Sema&, bool, bool)
+ 554
30 clang           0x000000000088d184 clang::CodeGenAction::ExecuteAction() +
68
31 clang           0x00000000007586e3 clang::FrontendAction::Execute() + 131
32 clang           0x0000000000739721
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 337
33 clang           0x0000000000720a3a
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 1098
34 clang           0x000000000071a89a cc1_main(char const**, char const**, char
const*, void*) + 6938
35 clang           0x000000000070a249 main + 7689
36 libc.so.6       0x000000368de21735 __libc_start_main + 245
37 clang           0x0000000000718149
Stack dump:
0.    Program arguments:
/home/david/data/llvm-3.1-obj/Release+Asserts/bin/clang -cc1 -triple
x86_64-unknown-linux-gnu -emit-obj -mrelax-all -disable-free -main-file-name
transposition.cpp -mrelocation-model static -mdisable-fp-elim -fmath-errno
-masm-verbose -mconstructor-aliases -munwind-tables -fuse-init-array
-target-cpu x86-64 -target-linker-version 2.22.52.0.1 -momit-leaf-frame-pointer
-g -coverage-file build/debug/transposition.o -resource-dir
/home/david/data/llvm-3.1-obj/Release+Asserts/bin/../lib/clang/3.2
-fmodule-cache-path /var/tmp/clang-module-cache -internal-isystem
/usr/lib/gcc/x86_64-redhat-linux/4.7.0/../../../../include/c++/4.7.0
-internal-isystem
/usr/lib/gcc/x86_64-redhat-linux/4.7.0/../../../../include/c++/4.7.0/x86_64-redhat-linux
-internal-isystem
/usr/lib/gcc/x86_64-redhat-linux/4.7.0/../../../../include/c++/4.7.0/backward
-internal-isystem /usr/local/include -internal-isystem
/home/david/data/llvm-3.1-obj/Release+Asserts/bin/../lib/clang/3.2/include
-internal-externc-isystem /include -internal-externc-isystem /usr/include
-Weverything -Werror -Wno-c++98-compat -Wno-exit-time-destructors -Wno-padded
-Wno-switch-enum -Wno-unused-parameter -Wno-conversion -Wno-weak-vtables
-std=c++11 -fdeprecated-macro -fdebug-compilation-dir
/home/david/technical-machine -ferror-limit 19 -fmessage-length 104
-mstackrealign -fobjc-runtime=gnu-fragile -fcxx-exceptions -fexceptions
-fdiagnostics-show-option -o build/debug/transposition.o -x c++
src/transposition.cpp 
1.    <eof> parser at end of file
2.    Per-file LLVM IR generation
3.    src/transposition.cpp:62:8: Generating code for declaration
'technicalmachine::<anonymous namespace>::hash_table_lookup'
4.    src/transposition.cpp:62:49: LLVM IR generation of compound statement
('{}')
clang: error: unable to execute command: Aborted (core dumped)
clang: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 3.2 (trunk 159509)
Target: x86_64-unknown-linux-gnu
Thread model: posix



run script:

 "/home/david/data/llvm-3.1-obj/Release+Asserts/bin/clang" -cc1 -triple
x86_64-unknown-linux-gnu -emit-obj -disable-free -main-file-name
transposition.cpp -mrelocation-model static -menable-no-infs -menable-no-nans
-menable-unsafe-fp-math -ffast-math -masm-verbose -mconstructor-aliases
-munwind-tables -fuse-init-array -target-cpu corei7 -target-linker-version
2.22.52.0.1 -momit-leaf-frame-pointer -g -internal-isystem
/usr/lib/gcc/x86_64-redhat-linux/4.7.0/../../../../include/c++/4.7.0
-internal-isystem
/usr/lib/gcc/x86_64-redhat-linux/4.7.0/../../../../include/c++/4.7.0/x86_64-redhat-linux
-internal-isystem
/usr/lib/gcc/x86_64-redhat-linux/4.7.0/../../../../include/c++/4.7.0/backward
-internal-isystem /usr/local/include -internal-isystem
/home/david/data/llvm-3.1-obj/Release+Asserts/bin/../lib/clang/3.2/include
-internal-externc-isystem /include -internal-externc-isystem /usr/include -O3
-Weverything -Werror -Wno-c++98-compat -Wno-exit-time-destructors -Wno-padded
-Wno-switch-enum -Wno-unused-parameter -Wno-conversion -Wno-weak-vtables
-std=c++11 -fdeprecated-macro -ferror-limit 19 -fmessage-length 104
-mstackrealign -fobjc-runtime=gnu-fragile -fcxx-exceptions -fexceptions
-fdiagnostics-show-option -x c++ transposition-DfgnY1.cpp

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