[llvm-bugs] [Bug 31366] New: Assertion `isa<X>(Val) && "cast<Ty>() argument of incompatible type!"' failed.
via llvm-bugs
llvm-bugs at lists.llvm.org
Tue Dec 13 13:22:01 PST 2016
https://llvm.org/bugs/show_bug.cgi?id=31366
Bug ID: 31366
Summary: Assertion `isa<X>(Val) && "cast<Ty>() argument of
incompatible type!"' failed.
Product: clang
Version: trunk
Hardware: PC
OS: Windows NT
Status: NEW
Severity: normal
Priority: P
Component: -New Bugs
Assignee: unassignedclangbugs at nondot.org
Reporter: douglas_yung at playstation.sony.com
CC: llvm-bugs at lists.llvm.org
Classification: Unclassified
Starting with r289225, we started to see an assertion failure in one of our C
tests when compiled with -g. To reproduce the failure, compile the following
code with a compiler built post-r289225 using -g:
int test(struct {
enum { a = 1 } b;
} c)
{
return a;
}
When compiling on my linux machine with a compiler built from r289225, this is
the output I get:
> clang -c repro.c -g
repro.c:2:12: warning: declaration of 'enum (anonymous at repro.c:2:12)' will
not be visible outside of this function [-Wvisibility]
enum { a = 1 } b;
^
clang-4.0:
/home/dyung/src/upstream/llvm_clean/include/llvm/Support/Casting.h:236:
typename llvm::cast_retty<X, Y*>::ret_type llvm::cast(Y*) [with X =
clang::EnumDecl; Y = const clang::DeclContext; typename llvm::cast_retty<X,
Y*>::re$_type = const clang::EnumDecl*]: Assertion `isa<X>(Val) && "cast<Ty>()
argument of incompatible type!"' failed.
#0 0x0000000001d410b5 llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/home/dyung/src/upstream/289225-linux/bin/clang-4.0+0x1d410b5)
#1 0x0000000001d3f08e llvm::sys::RunSignalHandlers()
(/home/dyung/src/upstream/289225-linux/bin/clang-4.0+0x1d3f08e)
#2 0x0000000001d3f1f2 SignalHandler(int)
(/home/dyung/src/upstream/289225-linux/bin/clang-4.0+0x1d3f1f2)
#3 0x00007f4f8b09a330 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x10330)
#4 0x00007f4f8a2d7c37 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x36c37)
#5 0x00007f4f8a2db028 abort (/lib/x86_64-linux-gnu/libc.so.6+0x3a028)
#6 0x00007f4f8a2d0bf6 (/lib/x86_64-linux-gnu/libc.so.6+0x2fbf6)
#7 0x00007f4f8a2d0ca2 (/lib/x86_64-linux-gnu/libc.so.6+0x2fca2)
#8 0x0000000001ecceff
clang::CodeGen::CGDebugInfo::EmitGlobalVariable(clang::ValueDecl const*,
clang::APValue const&)
(/home/dyung/src/upstream/289225-linux/bin/clang-4.0+0x1ecceff)
#9 0x000000000203d72f
clang::CodeGen::CodeGenFunction::tryEmitAsConstant(clang::DeclRefExpr*)
(/home/dyung/src/upstream/289225-linux/bin/clang-4.0+0x203d72f)
#10 0x000000000088cddd (anonymous
namespace)::ScalarExprEmitter::VisitDeclRefExpr(clang::DeclRefExpr*)
(/home/dyung/src/upstream/289225-linux/bin/clang-4.0+0x88cddd)
#11 0x000000000206db88 (anonymous
namespace)::ScalarExprEmitter::Visit(clang::Expr*)
(/home/dyung/src/upstream/289225-linux/bin/clang-4.0+0x206db88)
#12 0x000000000206eb13
clang::CodeGen::CodeGenFunction::EmitScalarExpr(clang::Expr const*, bool)
(/home/dyung/src/upstream/289225-linux/bin/clang-4.0+0x206eb13)
#13 0x0000000001eead3b
clang::CodeGen::CodeGenFunction::EmitReturnStmt(clang::ReturnStmt const&)
(/home/dyung/src/upstream/289225-linux/bin/clang-4.0+0x1eead3b)
#14 0x0000000001eedfd7
clang::CodeGen::CodeGenFunction::EmitCompoundStmtWithoutScope(clang::CompoundStmt
const&, bool, clang::CodeGen::AggValueSlot)
(/home/dyung/src/upstream/289225-linux/bin/clang-4.0+0x1eedfd7)
#15 0x0000000001f15827
clang::CodeGen::CodeGenFunction::EmitFunctionBody(clang::CodeGen::FunctionArgList&,
clang::Stmt const*)
(/home/dyung/src/upstream/289225-linux/bin/clang-4.0+0x1f15827)
#16 0x0000000001f200f1
clang::CodeGen::CodeGenFunction::GenerateCode(clang::GlobalDecl,
llvm::Function*, clang::CodeGen::CGFunctionInfo const&)
(/home/dyung/src/upstream/289225-linux/bin/clang-4.0+0x1f200f1)
#17 0x0000000001f3eb09
clang::CodeGen::CodeGenModule::EmitGlobalFunctionDefinition(clang::GlobalDecl,
llvm::GlobalValue*)
(/home/dyung/src/upstream/289225-linux/bin/clang-4.0+0x1f3eb09)
#18 0x0000000001f51c11
clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl,
llvm::GlobalValue*)
(/home/dyung/src/upstream/289225-linux/bin/clang-4.0+0x1f51c11)
#19 0x0000000001f52a80
clang::CodeGen::CodeGenModule::EmitGlobal(clang::GlobalDecl)
(/home/dyung/src/upstream/289225-linux/bin/clang-4.0+0x1f52a80)
#20 0x0000000001f531b1
clang::CodeGen::CodeGenModule::EmitTopLevelDecl(clang::Decl*) [clone
.part.6215] (/home/dyung/src/upstream/289225-linux/bin/clang-4.0+0x1f531b1)
#21 0x00000000024e23a3 (anonymous
namespace)::CodeGeneratorImpl::HandleTopLevelDecl(clang::DeclGroupRef)
(/home/dyung/src/upstream/289225-linux/bin/clang-4.0+0x24e23a3)
#22 0x00000000024dc14d
clang::BackendConsumer::HandleTopLevelDecl(clang::DeclGroupRef)
(/home/dyung/src/upstream/289225-linux/bin/clang-4.0+0x24dc14d)
#23 0x00000000028d4ce6 clang::ParseAST(clang::Sema&, bool, bool)
(/home/dyung/src/upstream/289225-linux/bin/clang-4.0+0x28d4ce6)
#24 0x00000000024dcdde clang::CodeGenAction::ExecuteAction()
(/home/dyung/src/upstream/289225-linux/bin/clang-4.0+0x24dcdde)
#25 0x00000000021e7fd6 clang::FrontendAction::Execute()
(/home/dyung/src/upstream/289225-linux/bin/clang-4.0+0x21e7fd6)
#26 0x00000000021c2226
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/home/dyung/src/upstream/289225-linux/bin/clang-4.0+0x21c2226)
#27 0x0000000002270e9a
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/home/dyung/src/upstream/289225-linux/bin/clang-4.0+0x2270e9a)
#28 0x0000000000ac8d38 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/home/dyung/src/upstream/289225-linux/bin/clang-4.0+0xac8d38)
#29 0x0000000000a6ad01 main
(/home/dyung/src/upstream/289225-linux/bin/clang-4.0+0xa6ad01)
#30 0x00007f4f8a2c2f45 __libc_start_main
(/lib/x86_64-linux-gnu/libc.so.6+0x21f45)
#31 0x0000000000ac4d3e _start
(/home/dyung/src/upstream/289225-linux/bin/clang-4.0+0xac4d3e)
Stack dump:
0. Program arguments: /home/dyung/src/upstream/289225-linux/bin/clang-4.0
-cc1 -triple x86_64-unknown-linux-gnu -emit-obj -mrelax-all -disable-free
-main-file-name repro.c -mrelocation-model static -mthread-model posix
-mdisable-$p-elim -fmath-errno -masm-verbose -mconstructor-aliases
-munwind-tables -fuse-init-array -target-cpu x86-64 -dwarf-column-info
-debug-info-kind=limited -dwarf-version=4 -debugger-tuning=gdb
-coverage-notes-file /home/dyung/src/patches$165586/repro.gcno -resource-dir
/home/dyung/src/upstream/289225-linux/bin/../lib/clang/4.0.0 -internal-isystem
/usr/local/include -internal-isystem
/home/dyung/src/upstream/289225-linux/bin/../lib/clang/4.0.0/include
-internal-externc$isystem /usr/include/x86_64-linux-gnu
-internal-externc-isystem /include -internal-externc-isystem /usr/include
-fdebug-compilation-dir /home/dyung/src/patches/165586 -ferror-limit 19
-fmessage-length 235 -fobjc-runtime=gcc -fdiagnost$cs-show-option -o repro.o -x
c repro.c
1. <eof> parser at end of file
2. repro.c:1:5: LLVM IR generation of declaration 'test'
3. repro.c:1:5: Generating code for declaration 'test'
clang-4.0: error: unable to execute command: Aborted (core dumped)
clang-4.0: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 4.0.0 (trunk 289225)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/dyung/src/upstream/289225-linux/bin
Thanks to Robert Lougher for finding the repro listed above.
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20161213/a0b863ac/attachment-0001.html>
More information about the llvm-bugs
mailing list