[llvm-bugs] [Bug 45341] Crash in code generation or optimizer
via llvm-bugs
llvm-bugs at lists.llvm.org
Wed Apr 1 11:40:01 PDT 2020
https://bugs.llvm.org/show_bug.cgi?id=45341
Reid Kleckner <rnk at google.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |FIXED
CC| |rnk at google.com
Status|NEW |RESOLVED
--- Comment #1 from Reid Kleckner <rnk at google.com> ---
I went and got this symbolized stack trace on Linux (ignore clang-8, this was
the 7.1.0 release). See below.
I couldn't say for sure that this is, honestly. :) It looks like clang is
emitting some statement, and then it runs all the destructor cleanups for the
statement, and somehow that isn't working. To simplify the code to make it
compile, I would try to make fewer temporaries.
I will mark this bug fixed since it doesn't reproduce in newer versions.
Hopefully this is enough info to work around the problem.
clang-8:
/usr/local/google/home/rnk/llvm-project/llvm/include/llvm/Support/Casting.h:255:
typename cast_retty<X, Y *>::ret_type llvm::cast(Y *) [X =
clang::CXXMethodDecl, Y = const clang::Decl]: Assertion `isa<X>(Val) &&
"cast<Ty>() argument of incompatible type!"' failed.
Stack dump:
0. Program arguments:
/usr/local/google/home/rnk/llvm-project/build/bin/clang-8 -cc1 -triple
x86_64-pc-windows-msvc19.11.0 -emit-obj -mrelax-all
-mincremental-linker-compatible -disable-free -main-file-name t-c41583.cpp
-mrelocation-model pic -pic-level 2 -mthread-model posix -relaxed-aliasing
-fmath-errno -masm-verbose -mconstructor-aliases -munwind-tables -target-cpu
x86-64 -mllvm -x86-asm-syntax=intel -D_MT -flto-visibility-public-std
--dependent-lib=libcmt --dependent-lib=oldnames -stack-protector 2
-fcxx-exceptions -fexceptions -fexternc-nounwind -fms-volatile
-fdiagnostics-format msvc -dwarf-column-info -debugger-tuning=gdb
-momit-leaf-frame-pointer -coverage-notes-file
/usr/local/google/home/rnk/llvm-project/build/t-c41583.gcno -resource-dir
/usr/local/google/home/rnk/llvm-project/build/lib/clang/7.1.0 -internal-isystem
/usr/local/google/home/rnk/llvm-project/build/lib/clang/7.1.0/include -w
-fdeprecated-macro -fdebug-compilation-dir
/usr/local/google/home/rnk/llvm-project/build -ferror-limit 19 -fmessage-length
0 -fno-use-cxa-atexit -fms-extensions -fms-compatibility
-fms-compatibility-version=19.11 -std=c++17 -fdelayed-template-parsing
-fobjc-runtime=gcc -fdiagnostics-show-option -o t-c41583.obj -x c++
t-c41583.cpp
1. <eof> parser at end of file
2. t.cpp:18:6: LLVM IR generation of declaration 'f'
3. t.cpp:18:6: Generating code for declaration 'f'
#0 0x0000000003c11c49 PrintStackTrace
/usr/local/google/home/rnk/llvm-project/llvm/lib/Support/Unix/Signals.inc:490:13
#1 0x0000000003c11c49 PrintStackTraceSignalHandler(void*)
/usr/local/google/home/rnk/llvm-project/llvm/lib/Support/Unix/Signals.inc:553:3
#2 0x0000000003c0fbd8 llvm::sys::RunSignalHandlers()
/usr/local/google/home/rnk/llvm-project/llvm/lib/Support/Signals.cpp:68:18
#3 0x0000000003c11dfe SignalHandler(int)
/usr/local/google/home/rnk/llvm-project/llvm/lib/Support/Unix/Signals.inc:353:1
#4 0x00007f37ee172520 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x13520)
#5 0x00007f37edc42081 raise
/build/glibc-QG9qOO/glibc-2.29/signal/../sysdeps/unix/sysv/linux/raise.c:51:1
#6 0x00007f37edc2d535 abort /build/glibc-QG9qOO/glibc-2.29/stdlib/abort.c:81:7
#7 0x00007f37edc2d40f _nl_load_domain
/build/glibc-QG9qOO/glibc-2.29/intl/loadmsgcat.c:1177:9
#8 0x00007f37edc3ab92 (/lib/x86_64-linux-gnu/libc.so.6+0x32b92)
#9 0x0000000003f4297b doit
/usr/local/google/home/rnk/llvm-project/llvm/include/llvm/Support/Casting.h:106:5
#10 0x0000000003f4297b doit
/usr/local/google/home/rnk/llvm-project/llvm/include/llvm/Support/Casting.h:133:12
#11 0x0000000003f4297b doit
/usr/local/google/home/rnk/llvm-project/llvm/include/llvm/Support/Casting.h:123:12
#12 0x0000000003f4297b isa<clang::CXXRecordDecl, const clang::DeclContext *>
/usr/local/google/home/rnk/llvm-project/llvm/include/llvm/Support/Casting.h:143:10
#13 0x0000000003f4297b cast<clang::CXXRecordDecl, const clang::DeclContext>
/usr/local/google/home/rnk/llvm-project/llvm/include/llvm/Support/Casting.h:255:3
#14 0x0000000003f4297b getParent
/usr/local/google/home/rnk/llvm-project/clang/include/clang/AST/DeclCXX.h:2166:12
#15 0x0000000003f4297b (anonymous
namespace)::CallBaseDtor::Emit(clang::CodeGen::CodeGenFunction&,
clang::CodeGen::EHScopeStack::Cleanup::Flags)
/usr/local/google/home/rnk/llvm-project/clang/lib/CodeGen/CGClass.cpp:490:47
#16 0x0000000003f199f2 HaveInsertPoint
/usr/local/google/home/rnk/llvm-project/clang/lib/CodeGen/CodeGenFunction.h:2067:37
#17 0x0000000003f199f2 EmitCleanup(clang::CodeGen::CodeGenFunction&,
clang::CodeGen::EHScopeStack::Cleanup*,
clang::CodeGen::EHScopeStack::Cleanup::Flags, clang::CodeGen::Address)
/usr/local/google/home/rnk/llvm-project/clang/lib/CodeGen/CGCleanup.cpp:580:3
#18 0x0000000003f18ca9 clang::CodeGen::CodeGenFunction::PopCleanupBlock(bool)
/usr/local/google/home/rnk/llvm-project/clang/lib/CodeGen/CGCleanup.cpp:1007:9
#19 0x0000000003f17106 stable_begin
/usr/local/google/home/rnk/llvm-project/clang/lib/CodeGen/EHScopeStack.h:380:28
#20 0x0000000003f17106
clang::CodeGen::CodeGenFunction::PopCleanupBlocks(clang::CodeGen::EHScopeStack::stable_iterator,
std::initializer_list<llvm::Value**>)
/usr/local/google/home/rnk/llvm-project/clang/lib/CodeGen/CGCleanup.cpp:430:18
#21 0x0000000003f192b2
clang::CodeGen::CodeGenFunction::PopCleanupBlocks(clang::CodeGen::EHScopeStack::stable_iterator,
unsigned long, std::initializer_list<llvm::Value**>)
/usr/local/google/home/rnk/llvm-project/clang/lib/CodeGen/CGCleanup.cpp:487:19
#22 0x0000000003fe7a12 ForceCleanup
/usr/local/google/home/rnk/llvm-project/clang/lib/CodeGen/CodeGenFunction.h:0:11
#23 0x0000000003fe7a12 VisitExprWithCleanups
/usr/local/google/home/rnk/llvm-project/clang/lib/CodeGen/CGExprScalar.cpp:1957:9
#24 0x0000000003fe7a12 clang::StmtVisitorBase<clang::make_ptr, (anonymous
namespace)::ScalarExprEmitter, llvm::Value*>::Visit(clang::Stmt*)
/usr/local/google/home/rnk/llvm-project/build/tools/clang/include/clang/AST/StmtNodes.inc:507:1
#25 0x0000000003fde678 Visit
/usr/local/google/home/rnk/llvm-project/clang/lib/CodeGen/CGExprScalar.cpp:376:52
#26 0x0000000003fde678
clang::CodeGen::CodeGenFunction::EmitScalarExpr(clang::Expr const*, bool)
/usr/local/google/home/rnk/llvm-project/clang/lib/CodeGen/CGExprScalar.cpp:3970:8
#27 0x0000000003f5aa02 clang::CodeGen::CodeGenFunction::EmitAnyExpr(clang::Expr
const*, clang::CodeGen::AggValueSlot, bool)
/usr/local/google/home/rnk/llvm-project/clang/lib/CodeGen/CGExpr.cpp:199:24
#28 0x0000000003f5a9a9
clang::CodeGen::CodeGenFunction::EmitIgnoredExpr(clang::Expr const*)
/usr/local/google/home/rnk/llvm-project/clang/lib/CodeGen/CGExpr.cpp:188:1
#29 0x0000000003f4ace2 GetInsertBlock
/usr/local/google/home/rnk/llvm-project/llvm/include/llvm/IR/IRBuilder.h:121:47
#30 0x0000000003f4ace2 clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt
const*, llvm::ArrayRef<clang::Attr const*>)
/usr/local/google/home/rnk/llvm-project/clang/lib/CodeGen/CGStmt.cpp:118:42
#31 0x0000000003f53d10
clang::CodeGen::CodeGenFunction::EmitCompoundStmtWithoutScope(clang::CompoundStmt
const&, bool, clang::CodeGen::AggValueSlot)
/usr/local/google/home/rnk/llvm-project/clang/lib/CodeGen/CGStmt.cpp:389:36
#32 0x0000000003f2d2b6 getLangOpts
/usr/local/google/home/rnk/llvm-project/clang/lib/CodeGen/CodeGenFunction.h:1606:51
#33 0x0000000003f2d2b6
clang::CodeGen::CodeGenFunction::GenerateCode(clang::GlobalDecl,
llvm::Function*, clang::CodeGen::CGFunctionInfo const&)
/usr/local/google/home/rnk/llvm-project/clang/lib/CodeGen/CodeGenFunction.cpp:1365:7
#34 0x0000000003ebe070
clang::CodeGen::CodeGenModule::EmitGlobalFunctionDefinition(clang::GlobalDecl,
llvm::GlobalValue*)
/usr/local/google/home/rnk/llvm-project/clang/lib/CodeGen/CodeGenModule.cpp:3867:3
#35 0x0000000003eb6544
clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl,
llvm::GlobalValue*)
/usr/local/google/home/rnk/llvm-project/clang/lib/CodeGen/CodeGenModule.cpp:0:12
#36 0x0000000003ec1742
clang::CodeGen::CodeGenModule::EmitTopLevelDecl(clang::Decl*)
/usr/local/google/home/rnk/llvm-project/clang/lib/CodeGen/CodeGenModule.cpp:4617:5
#37 0x00000000043bef10 (anonymous
namespace)::CodeGeneratorImpl::HandleTopLevelDecl(clang::DeclGroupRef)
/usr/local/google/home/rnk/llvm-project/clang/lib/CodeGen/ModuleBuilder.cpp:159:73
#38 0x00000000043bd06a
clang::BackendConsumer::HandleTopLevelDecl(clang::DeclGroupRef)
/usr/local/google/home/rnk/llvm-project/clang/lib/CodeGen/CodeGenAction.cpp:171:11
#39 0x00000000043900ec operator++
/usr/lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/bits/stl_iterator.h:829:2
#40 0x00000000043900ec
clang::MultiplexConsumer::HandleTopLevelDecl(clang::DeclGroupRef)
/usr/local/google/home/rnk/llvm-project/clang/lib/Frontend/MultiplexConsumer.cpp:265:23
#41 0x0000000004d6a345 clang::ParseAST(clang::Sema&, bool, bool)
/usr/local/google/home/rnk/llvm-project/clang/lib/Parse/ParseAST.cpp:162:9
#42 0x0000000004320057 clang::FrontendAction::Execute()
/usr/local/google/home/rnk/llvm-project/clang/lib/Frontend/FrontendAction.cpp:914:10
#43 0x000000000429820e
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
/usr/local/google/home/rnk/llvm-project/clang/lib/Frontend/CompilerInstance.cpp:962:11
#44 0x00000000043b7c34
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
/usr/local/google/home/rnk/llvm-project/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp:257:25
#45 0x00000000022eb7b3 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*)
/usr/local/google/home/rnk/llvm-project/clang/tools/driver/cc1_main.cpp:218:13
#46 0x00000000022e7d0b ExecuteCC1Tool
/usr/local/google/home/rnk/llvm-project/clang/tools/driver/driver.cpp:310:12
#47 0x00000000022e7d0b main
/usr/local/google/home/rnk/llvm-project/clang/tools/driver/driver.cpp:382:12
#48 0x00007f37edc2ebbb __libc_start_main
/build/glibc-QG9qOO/glibc-2.29/csu/../csu/libc-start.c:342:3
#49 0x00000000022e6e4a _start
(/usr/local/google/home/rnk/llvm-project/build/bin/clang-8+0x22e6e4a)
clang-8: error: unable to execute command: Aborted
--
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/20200401/0cf9a2e6/attachment.html>
More information about the llvm-bugs
mailing list