[LLVMbugs] [Bug 13173] New: dynamic_cast<void*> triggers assertion

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Jun 21 20:55:47 PDT 2012


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

             Bug #: 13173
           Summary: dynamic_cast<void*> triggers assertion
           Product: clang
           Version: unspecified
          Platform: PC
        OS/Version: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: cam at mcc.id.au
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified


Created attachment 8742
  --> http://llvm.org/bugs/attachment.cgi?id=8742
test

The attachment fails to compile and produces:

bug.cpp:8:3: warning: expression result unused [-Wunused-value]
  dynamic_cast<void*>(a);
  ^~~~~~~~~~~~~~~~~~~~~~
Assertion failed: (isa<X>(Val) && "cast<Ty>() argument of incompatible type!"),
function cast, file /Volumes/Data/llvm/include/llvm/Support/Casting.h, line
194.
0  clang             0x000000010d5d0aa2 _ZL15PrintStackTracePv + 34
1  clang             0x000000010d5d0f89 _ZL13SignalHandleri + 649
2  libsystem_c.dylib 0x00007fff89ba2cfa _sigtramp + 26
3  libsystem_c.dylib 000000000000000000 _sigtramp + 18446603338205483808
4  clang             0x000000010d5d0ce6 abort + 22
5  clang             0x000000010d5d0ca5 __assert_rtn + 53
6  clang             0x000000010c9f3680
clang::CXXDynamicCastExpr::isAlwaysNull() const + 288
7  clang             0x000000010c25f63e
clang::CodeGen::CodeGenFunction::EmitDynamicCast(llvm::Value*,
clang::CXXDynamicCastExpr const*) + 62
8  clang             0x000000010c27923a (anonymous
namespace)::ScalarExprEmitter::VisitCastExpr(clang::CastExpr*) + 1082
9  clang             0x000000010c275342 clang::StmtVisitorBase<clang::make_ptr,
(anonymous namespace)::ScalarExprEmitter, llvm::Value*>::Visit(clang::Stmt*) +
15074
10 clang             0x000000010c26c7d0
clang::CodeGen::CodeGenFunction::EmitScalarExpr(clang::Expr const*, bool) + 96
11 clang             0x000000010c2447b9
clang::CodeGen::CodeGenFunction::EmitAnyExpr(clang::Expr const*,
clang::CodeGen::AggValueSlot, bool) + 57
12 clang             0x000000010c244769
clang::CodeGen::CodeGenFunction::EmitIgnoredExpr(clang::Expr const*) + 41
13 clang             0x000000010c2c1ab7
clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt const*) + 391
14 clang             0x000000010c2c6afb
clang::CodeGen::CodeGenFunction::EmitCompoundStmt(clang::CompoundStmt const&,
bool, clang::CodeGen::AggValueSlot) + 235
15 clang             0x000000010c2c1f0d
clang::CodeGen::CodeGenFunction::EmitSimpleStmt(clang::Stmt const*) + 125
16 clang             0x000000010c2c1959
clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt const*) + 41
17 clang             0x000000010c2d2a76
clang::CodeGen::CodeGenFunction::GenerateCode(clang::GlobalDecl,
llvm::Function*, clang::CodeGen::CGFunctionInfo const&) + 854
18 clang             0x000000010c2db231
clang::CodeGen::CodeGenModule::EmitGlobalFunctionDefinition(clang::GlobalDecl)
+ 2113
19 clang             0x000000010c2d8b39
clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl) + 377
20 clang             0x000000010c2da195
clang::CodeGen::CodeGenModule::EmitGlobal(clang::GlobalDecl) + 1509
21 clang             0x000000010c2df57a
clang::CodeGen::CodeGenModule::EmitTopLevelDecl(clang::Decl*) + 282
22 clang             0x000000010c2f98ef (anonymous
namespace)::CodeGeneratorImpl::HandleTopLevelDecl(clang::DeclGroupRef) + 127
23 clang             0x000000010c2cff8a
clang::BackendConsumer::HandleTopLevelDecl(clang::DeclGroupRef) + 170
24 clang             0x000000010c304cd2 clang::ParseAST(clang::Sema&, bool,
bool) + 482
25 clang             0x000000010c2cf329 clang::CodeGenAction::ExecuteAction() +
1273
26 clang             0x000000010c0e275b clang::FrontendAction::Execute() + 107
27 clang             0x000000010c0c40cf
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 991
28 clang             0x000000010c0ab53a
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 3178
29 clang             0x000000010c0a27cd cc1_main(char const**, char const**,
char const*, void*) + 5517
30 clang             0x000000010c0a78b7 main + 663
31 clang             0x000000010c0a1234 start + 52
32 clang             0x000000000000002e start + 18446744069212597806
Stack dump:
0.    Program arguments: /Volumes/Data/llvm/build/Release+Asserts/bin/clang
-cc1 -triple x86_64-apple-macosx10.7.0 -emit-obj -mrelax-all -disable-free
-main-file-name bug.cpp -pic-level 2 -mdisable-fp-elim -masm-verbose
-munwind-tables -target-cpu core2 -target-linker-version 127.2 -resource-dir
/Volumes/Data/llvm/build/Release+Asserts/bin/../lib/clang/3.2
-fmodule-cache-path
/var/folders/sd/x_v_g8n14d3cg8vgv1wwdv340000gn/T/clang-module-cache
-fdeprecated-macro -fdebug-compilation-dir /tmp -ferror-limit 19
-fmessage-length 272 -stack-protector 1 -mstackrealign -fblocks
-fobjc-runtime-has-arc -fobjc-runtime-has-weak -fobjc-dispatch-method=mixed
-fobjc-default-synthesize-properties -fcxx-exceptions -fexceptions
-fdiagnostics-show-option -fcolor-diagnostics -o
/var/folders/sd/x_v_g8n14d3cg8vgv1wwdv340000gn/T/bug-goB5Dc.o -x c++ bug.cpp 
1.    <eof> parser at end of file
2.    bug.cpp:6:6: LLVM IR generation of declaration 'f'
3.    bug.cpp:6:6: Generating code for declaration 'f'
4.    bug.cpp:7:1: LLVM IR generation of compound statement ('{}')
clang: error: unable to execute command: Illegal instruction: 4
clang: error: clang frontend command failed due to signal (use -v to see
invocation)
clang: note: diagnostic msg: Please submit a bug report to
http://llvm.org/bugs/ and include command line arguments and all diagnostic
information.
clang version 3.2 (trunk 158704)
Target: x86_64-apple-darwin11.4.0
Thread model: posix

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