Open
Description
#pragma CHECKED_SCOPE on
_Itype_for_any(T) void fn(void *ptr : itype(_Array_ptr<T>) byte_count(0)) {
_Dynamic_bounds_cast<_Array_ptr<T>>(ptr, byte_count(0));
}
fails to compile with
clang: /home/john/checkedc-clang/clang/lib/CodeGen/CGExprScalar.cpp:2229: llvm::Value* {anonymous}::ScalarExprEmitter::VisitCastExpr(clang::CastExpr*): Assertion `CGF.getContext().hasSameUnqualifiedUncheckedType(E->getType(), DestTy)' failed.
PLEASE submit a bug report to https://github.com/Microsoft/checkedc-clang/issues and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0. Program arguments: clang -c test.c
1. <eof> parser at end of file
2. test.c:2:24: LLVM IR generation of declaration 'fn'
3. test.c:2:24: Generating code for declaration 'fn'
#0 0x000055bd4641f381 llvm::sys::PrintStackTrace(llvm::raw_ostream&) /home/john/checkedc-clang/llvm/build/../lib/Support/Unix/Signals.inc:564:22
#1 0x000055bd4641f418 PrintStackTraceSignalHandler(void*) /home/john/checkedc-clang/llvm/build/../lib/Support/Unix/Signals.inc:625:1
#2 0x000055bd4641d16b llvm::sys::RunSignalHandlers() /home/john/checkedc-clang/llvm/build/../lib/Support/Signals.cpp:68:20
#3 0x000055bd4641eb87 llvm::sys::CleanupOnSignal(unsigned long) /home/john/checkedc-clang/llvm/build/../lib/Support/Unix/Signals.inc:361:31
#4 0x000055bd4635f728 (anonymous namespace)::CrashRecoveryContextImpl::HandleCrash(int, unsigned long) /home/john/checkedc-clang/llvm/build/../lib/Support/CrashRecoveryContext.cpp:77:5
#5 0x000055bd4635fc1a CrashRecoverySignalHandler(int) /home/john/checkedc-clang/llvm/build/../lib/Support/CrashRecoveryContext.cpp:383:1
#6 0x00007f815bda23c0 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x153c0)
#7 0x00007f815b84118b raise /build/glibc-eX1tMB/glibc-2.31/signal/../sysdeps/unix/sysv/linux/raise.c:51:1
#8 0x00007f815b820859 abort /build/glibc-eX1tMB/glibc-2.31/stdlib/abort.c:81:7
#9 0x00007f815b820729 get_sysdep_segment_value /build/glibc-eX1tMB/glibc-2.31/intl/loadmsgcat.c:509:8
#10 0x00007f815b820729 _nl_load_domain /build/glibc-eX1tMB/glibc-2.31/intl/loadmsgcat.c:970:34
#11 0x00007f815b831f36 (/lib/x86_64-linux-gnu/libc.so.6+0x36f36)
#12 0x000055bd46d2cde0 (anonymous namespace)::ScalarExprEmitter::VisitCastExpr(clang::CastExpr*) /home/john/checkedc-clang/clang/lib/CodeGen/CGExprScalar.cpp:2230:5
#13 0x000055bd46d3f5b9 clang::StmtVisitorBase<std::add_pointer, (anonymous namespace)::ScalarExprEmitter, llvm::Value*>::VisitImplicitCastExpr(clang::ImplicitCastExpr*) /home/john/checkedc-clang/llvm/build/tools/clang/include/clang/AST/StmtNodes.inc:963:1
#14 0x000055bd46d3db47 clang::StmtVisitorBase<std::add_pointer, (anonymous namespace)::ScalarExprEmitter, llvm::Value*>::Visit(clang::Stmt*) /home/john/checkedc-clang/llvm/build/tools/clang/include/clang/AST/StmtNodes.inc:963:1
#15 0x000055bd46d23995 (anonymous namespace)::ScalarExprEmitter::Visit(clang::Expr*) /home/john/checkedc-clang/clang/lib/CodeGen/CGExprScalar.cpp:412:57
#16 0x000055bd46d2c156 (anonymous namespace)::ScalarExprEmitter::VisitCastExpr(clang::CastExpr*) /home/john/checkedc-clang/clang/lib/CodeGen/CGExprScalar.cpp:2060:23
#17 0x000055bd46d24871 (anonymous namespace)::ScalarExprEmitter::VisitExplicitCastExpr(clang::ExplicitCastExpr*) /home/john/checkedc-clang/clang/lib/CodeGen/CGExprScalar.cpp:574:3
#18 0x000055bd46d3f489 clang::StmtVisitorBase<std::add_pointer, (anonymous namespace)::ScalarExprEmitter, llvm::Value*>::VisitCStyleCastExpr(clang::CStyleCastExpr*) /home/john/checkedc-clang/llvm/build/tools/clang/include/clang/AST/StmtNodes.inc:903:1
#19 0x000055bd46d3da87 clang::StmtVisitorBase<std::add_pointer, (anonymous namespace)::ScalarExprEmitter, llvm::Value*>::Visit(clang::Stmt*) /home/john/checkedc-clang/llvm/build/tools/clang/include/clang/AST/StmtNodes.inc:903:1
#20 0x000055bd46d23995 (anonymous namespace)::ScalarExprEmitter::Visit(clang::Expr*) /home/john/checkedc-clang/clang/lib/CodeGen/CGExprScalar.cpp:412:57
#21 0x000055bd46d3adcf clang::CodeGen::CodeGenFunction::EmitScalarExpr(clang::Expr const*, bool) /home/john/checkedc-clang/clang/lib/CodeGen/CGExprScalar.cpp:4750:1
#22 0x000055bd46cd3dd5 clang::CodeGen::CodeGenFunction::EmitPointerWithAlignment(clang::Expr const*, clang::CodeGen::LValueBaseInfo*, clang::CodeGen::TBAAAccessInfo*) (.localalias) /home/john/checkedc-clang/clang/lib/CodeGen/CGExpr.cpp:1170:10
#23 0x000055bd46cba086 clang::CodeGen::CodeGenFunction::EmitDynamicBoundsCastCheck(clang::CodeGen::Address, clang::BoundsExpr const*, clang::BoundsExpr const*) /home/john/checkedc-clang/clang/lib/CodeGen/CGDynamicCheck.cpp:276:68
#24 0x000055bd46ceded7 clang::CodeGen::CodeGenFunction::EmitBoundsCast(clang::CastExpr*) /home/john/checkedc-clang/clang/lib/CodeGen/CGExpr.cpp:5445:25
#25 0x000055bd46d2ca42 (anonymous namespace)::ScalarExprEmitter::VisitCastExpr(clang::CastExpr*) /home/john/checkedc-clang/clang/lib/CodeGen/CGExprScalar.cpp:2170:30
#26 0x000055bd46d24871 (anonymous namespace)::ScalarExprEmitter::VisitExplicitCastExpr(clang::ExplicitCastExpr*) /home/john/checkedc-clang/clang/lib/CodeGen/CGExprScalar.cpp:574:3
#27 0x000055bd46d3f43d clang::StmtVisitorBase<std::add_pointer, (anonymous namespace)::ScalarExprEmitter, llvm::Value*>::VisitBoundsCastExpr(clang::BoundsCastExpr*) /home/john/checkedc-clang/llvm/build/tools/clang/include/clang/AST/StmtNodes.inc:891:1
#28 0x000055bd46d3da57 clang::StmtVisitorBase<std::add_pointer, (anonymous namespace)::ScalarExprEmitter, llvm::Value*>::Visit(clang::Stmt*) /home/john/checkedc-clang/llvm/build/tools/clang/include/clang/AST/StmtNodes.inc:891:1
#29 0x000055bd46d23995 (anonymous namespace)::ScalarExprEmitter::Visit(clang::Expr*) /home/john/checkedc-clang/clang/lib/CodeGen/CGExprScalar.cpp:412:57
#30 0x000055bd46d3adcf clang::CodeGen::CodeGenFunction::EmitScalarExpr(clang::Expr const*, bool) /home/john/checkedc-clang/clang/lib/CodeGen/CGExprScalar.cpp:4750:1
#31 0x000055bd46cce9a9 clang::CodeGen::CodeGenFunction::EmitAnyExpr(clang::Expr const*, clang::CodeGen::AggValueSlot, bool) /home/john/checkedc-clang/clang/lib/CodeGen/CGExpr.cpp:211:55
#32 0x000055bd46cce906 clang::CodeGen::CodeGenFunction::EmitIgnoredExpr(clang::Expr const*) /home/john/checkedc-clang/clang/lib/CodeGen/CGExpr.cpp:196:63
#33 0x000055bd46877848 clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt const*, llvm::ArrayRef<clang::Attr const*>) /home/john/checkedc-clang/clang/lib/CodeGen/CGStmt.cpp:118:56
#34 0x000055bd4687896a clang::CodeGen::CodeGenFunction::EmitCompoundStmtWithoutScope(clang::CompoundStmt const&, bool, clang::CodeGen::AggValueSlot) /home/john/checkedc-clang/clang/lib/CodeGen/CGStmt.cpp:418:3
#35 0x000055bd4691c44b clang::CodeGen::CodeGenFunction::EmitFunctionBody(clang::Stmt const*) /home/john/checkedc-clang/clang/lib/CodeGen/CodeGenFunction.cpp:1152:36
#36 0x000055bd4691d0e9 clang::CodeGen::CodeGenFunction::GenerateCode(clang::GlobalDecl, llvm::Function*, clang::CodeGen::CGFunctionInfo const&) /home/john/checkedc-clang/clang/lib/CodeGen/CodeGenFunction.cpp:1317:21
#37 0x000055bd469486e7 clang::CodeGen::CodeGenModule::EmitGlobalFunctionDefinition(clang::GlobalDecl, llvm::GlobalValue*) /home/john/checkedc-clang/clang/lib/CodeGen/CodeGenModule.cpp:4528:3
#38 0x000055bd46941214 clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl, llvm::GlobalValue*) /home/john/checkedc-clang/clang/lib/CodeGen/CodeGenModule.cpp:2890:47
#39 0x000055bd469401c2 clang::CodeGen::CodeGenModule::EmitGlobal(clang::GlobalDecl) /home/john/checkedc-clang/clang/lib/CodeGen/CodeGenModule.cpp:2643:5
#40 0x000055bd4694c8d5 clang::CodeGen::CodeGenModule::EmitTopLevelDecl(clang::Decl*) (.localalias) /home/john/checkedc-clang/clang/lib/CodeGen/CodeGenModule.cpp:5342:37
#41 0x000055bd479f69c1 (anonymous namespace)::CodeGeneratorImpl::HandleTopLevelDecl(clang::DeclGroupRef) /home/john/checkedc-clang/clang/lib/CodeGen/ModuleBuilder.cpp:169:7
#42 0x000055bd479efca6 clang::BackendConsumer::HandleTopLevelDecl(clang::DeclGroupRef) /home/john/checkedc-clang/clang/lib/CodeGen/CodeGenAction.cpp:216:7
#43 0x000055bd494a4f34 clang::ParseAST(clang::Sema&, bool, bool) /home/john/checkedc-clang/clang/lib/Parse/ParseAST.cpp:162:20
#44 0x000055bd47070b7b clang::ASTFrontendAction::ExecuteAction() /home/john/checkedc-clang/clang/lib/Frontend/FrontendAction.cpp:1057:11
#45 0x000055bd479ed9d5 clang::CodeGenAction::ExecuteAction() /home/john/checkedc-clang/clang/lib/CodeGen/CodeGenAction.cpp:1185:1
#46 0x000055bd470704d2 clang::FrontendAction::Execute() /home/john/checkedc-clang/clang/lib/Frontend/FrontendAction.cpp:954:38
#47 0x000055bd47000d61 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) /home/john/checkedc-clang/clang/lib/Frontend/CompilerInstance.cpp:984:42
#48 0x000055bd4720c545 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) /home/john/checkedc-clang/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp:278:38
#49 0x000055bd44aaa91b cc1_main(llvm::ArrayRef<char const*>, char const*, void*) /home/john/checkedc-clang/clang/tools/driver/cc1_main.cpp:240:40
#50 0x000055bd44a9f7e3 ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&) /home/john/checkedc-clang/clang/tools/driver/driver.cpp:330:20
#51 0x000055bd46ef664b clang::driver::CC1Command::Execute(llvm::ArrayRef<llvm::Optional<llvm::StringRef> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*, bool*) const::'lambda'()::operator()() const /home/john/checkedc-clang/clang/lib/Driver/Job.cpp:400:32
#52 0x000055bd46ef6f14 void llvm::function_ref<void ()>::callback_fn<clang::driver::CC1Command::Execute(llvm::ArrayRef<llvm::Optional<llvm::StringRef> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*, bool*) const::'lambda'()>(long) /home/john/checkedc-clang/llvm/include/llvm/ADT/STLExtras.h:186:40
#53 0x000055bd46352636 llvm::function_ref<void ()>::operator()() const /home/john/checkedc-clang/llvm/build/../include/llvm/ADT/STLExtras.h:203:62
#54 0x000055bd4635fe2c llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) /home/john/checkedc-clang/llvm/build/../lib/Support/CrashRecoveryContext.cpp:419:10
#55 0x000055bd46ef6873 clang::driver::CC1Command::Execute(llvm::ArrayRef<llvm::Optional<llvm::StringRef> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*, bool*) const /home/john/checkedc-clang/clang/lib/Driver/Job.cpp:400:7
#56 0x000055bd46ea96a1 clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&) const /home/john/checkedc-clang/clang/lib/Driver/Compilation.cpp:195:22
#57 0x000055bd46ea9a04 clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*> >&) const /home/john/checkedc-clang/clang/lib/Driver/Compilation.cpp:246:53
#58 0x000055bd46eb98b4 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*> >&) /home/john/checkedc-clang/clang/lib/Driver/Driver.cpp:1509:28
#59 0x000055bd44aa07b7 main /home/john/checkedc-clang/clang/tools/driver/driver.cpp:502:39
#60 0x00007f815b8220b3 __libc_start_main /build/glibc-eX1tMB/glibc-2.31/csu/../csu/libc-start.c:342:3
#61 0x000055bd44a9de7e _start (/home/john/checkedc-clang/llvm/build/bin/clang-11+0x2600e7e)
clang-11: error: clang frontend command failed due to signal (use -v to see invocation)
clang version 11.0.0 (https://github.com/correctcomputation/checkedc-clang.git 72cc3ab60e8f719b315a8b39a2f9e2e9c7ea1521)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/john/checkedc-clang/llvm/build/bin