[llvm-bugs] [Bug 46771] New: compiler crash when code generation for AVR target

via llvm-bugs llvm-bugs at lists.llvm.org
Sat Jul 18 04:36:13 PDT 2020


https://bugs.llvm.org/show_bug.cgi?id=46771

            Bug ID: 46771
           Summary: compiler crash when code generation for AVR target
           Product: new-bugs
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: s.pitchumani at gmail.com
                CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org

Created attachment 23751
  --> https://bugs.llvm.org/attachment.cgi?id=23751&action=edit
test case run script generated by clang

testcase:
struct st
{
  int m1;
  int m2;
} obj;
struct st foo ()
{
  return obj;
}
int main()
{
  struct st l = foo();
  return l.m1;
}

Command line: clang ret-st.c --target=avr -mmcu=atmega128 -c

Crash backtrace:

clang: /home/parallels/code/llvm-project.git/llvm/lib/IR/Constants.cpp:2028:
static llvm::Constant* llvm::ConstantExpr::getBitCast(llvm::Constant*,
llvm::Type*, bool): Assertion `CastInst::castIsValid(Instruction::BitCast, C,
DstTy) && "Invalid constantexpr bitcast!"' failed.
PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash
backtrace, preprocessed source, and associated run script.
Stack dump:
0.      Program arguments: ./bin/clang ../ret-st.c --target=avr -mmcu=atmega128
-c 
1.      <eof> parser at end of file
2.      ../ret-st.c:10:5: LLVM IR generation of declaration 'main'
3.      ../ret-st.c:10:5: Generating code for declaration 'main'
 #0 0x00007fbe9e3bbc8a llvm::sys::PrintStackTrace(llvm::raw_ostream&)
/home/parallels/code/llvm-project.git/llvm/lib/Support/Unix/Signals.inc:568:0
 #1 0x00007fbe9e3b9aba llvm::sys::RunSignalHandlers()
/home/parallels/code/llvm-project.git/llvm/lib/Support/Signals.cpp:68:0
 #2 0x00007fbe9e3ba2db llvm::sys::CleanupOnSignal(unsigned long)
/home/parallels/code/llvm-project.git/llvm/lib/Support/Unix/Signals.inc:361:0
 #3 0x00007fbe9e2df000 HandleCrash
/home/parallels/code/llvm-project.git/llvm/lib/Support/CrashRecoveryContext.cpp:75:0
 #4 0x00007fbe9e2df000 CrashRecoverySignalHandler(int)
/home/parallels/code/llvm-project.git/llvm/lib/Support/CrashRecoveryContext.cpp:382:0
 #5 0x00007fbea51770e0 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x110e0)
 #6 0x00007fbe9d07afff raise (/lib/x86_64-linux-gnu/libc.so.6+0x32fff)
 #7 0x00007fbe9d07c42a abort (/lib/x86_64-linux-gnu/libc.so.6+0x3442a)
 #8 0x00007fbe9d073e67 (/lib/x86_64-linux-gnu/libc.so.6+0x2be67)
 #9 0x00007fbe9d073f12 (/lib/x86_64-linux-gnu/libc.so.6+0x2bf12)
#10 0x00007fbe9e42a847
(/home/parallels/llvm-avr/build/bin/../lib/libLLVM-12git.so+0x7a6847)
#11 0x00007fbea2d7e657
clang::CodeGen::CodeGenModule::GetOrCreateLLVMFunction(llvm::StringRef,
llvm::Type*, clang::GlobalDecl, bool, bool, bool, llvm::AttributeList,
clang::CodeGen::ForDefinition_t)
/home/parallels/code/llvm-project.git/clang/lib/CodeGen/CodeGenModule.cpp:3215:0
#12 0x00007fbea2d7f566
clang::CodeGen::CodeGenModule::GetAddrOfFunction(clang::GlobalDecl,
llvm::Type*, bool, bool, clang::CodeGen::ForDefinition_t)
/home/parallels/code/llvm-project.git/clang/lib/CodeGen/CodeGenModule.cpp:3353:0
#13 0x00007fbea2b922cb clang::FunctionDecl::hasWrittenPrototype() const
/home/parallels/code/llvm-project.git/clang/include/clang/AST/Decl.h:2177:0
#14 0x00007fbea2b922cb clang::FunctionDecl::hasPrototype() const
/home/parallels/code/llvm-project.git/clang/include/clang/AST/Decl.h:2172:0
#15 0x00007fbea2b922cb EmitFunctionDeclPointer(clang::CodeGen::CodeGenModule&,
clang::GlobalDecl)
/home/parallels/code/llvm-project.git/clang/lib/CodeGen/CGExpr.cpp:2517:0
#16 0x00007fbea2b92660
clang::CodeGen::CGCallee::CGCallee(clang::CodeGen::CGCalleeInfo const&,
llvm::Value*)
/home/parallels/code/llvm-project.git/clang/lib/CodeGen/CGCall.h:115:0
#17 0x00007fbea2b92660 clang::CodeGen::CGCallee::forDirect(llvm::Constant*,
clang::CodeGen::CGCalleeInfo const&)
/home/parallels/code/llvm-project.git/clang/lib/CodeGen/CGCall.h:136:0
#18 0x00007fbea2b92660 EmitDirectCallee(clang::CodeGen::CodeGenFunction&,
clang::GlobalDecl) (.isra.1162)
/home/parallels/code/llvm-project.git/clang/lib/CodeGen/CGExpr.cpp:4791:0
#19 0x00007fbea2bace6f clang::CodeGen::CodeGenFunction::EmitCallee(clang::Expr
const*)
/home/parallels/code/llvm-project.git/clang/lib/CodeGen/CGExpr.cpp:4812:0
#20 0x00007fbea2bace0f clang::CodeGen::CodeGenFunction::EmitCallee(clang::Expr
const*)
/home/parallels/code/llvm-project.git/clang/lib/CodeGen/CGExpr.cpp:4844:0
#21 0x00007fbea2bad121
clang::CodeGen::CodeGenFunction::EmitCallExpr(clang::CallExpr const*,
clang::CodeGen::ReturnValueSlot)
/home/parallels/code/llvm-project.git/clang/lib/CodeGen/CGExpr.cpp:4756:0
#22 0x00007fbea2badc37 clang::CodeGen::RValue
llvm::function_ref<clang::CodeGen::RValue
(clang::CodeGen::ReturnValueSlot)>::callback_fn<(anonymous
namespace)::AggExprEmitter::VisitCallExpr(clang::CallExpr
const*)::'lambda'(clang::CodeGen::ReturnValueSlot)>(long,
clang::CodeGen::ReturnValueSlot)
/home/parallels/code/llvm-project.git/llvm/include/llvm/ADT/STLExtras.h:187:0
#23 0x00007fbea1aea727 (anonymous
namespace)::AggExprEmitter::withReturnValueSlot(clang::Expr const*,
llvm::function_ref<clang::CodeGen::RValue (clang::CodeGen::ReturnValueSlot)>)
/home/parallels/code/llvm-project.git/clang/lib/CodeGen/CGExprAgg.cpp:299:0
#24 0x00007fbea1aea8b3 (anonymous
namespace)::AggExprEmitter::VisitCallExpr(clang::CallExpr const*)
/home/parallels/code/llvm-project.git/clang/lib/CodeGen/CGExprAgg.cpp:923:0
#25 0x00007fbea2bb2bc2 Visit
/home/parallels/llvm-avr/build/tools/clang/include/clang/AST/StmtNodes.inc:813:0
#26 0x00007fbea2bb2bc2 (anonymous
namespace)::AggExprEmitter::Visit(clang::Expr*)
/home/parallels/code/llvm-project.git/clang/lib/CodeGen/CGExprAgg.cpp:107:0
#27 0x00007fbea2bb3876 clang::CodeGen::CodeGenFunction::EmitAggExpr(clang::Expr
const*, clang::CodeGen::AggValueSlot)
/home/parallels/code/llvm-project.git/clang/lib/CodeGen/CGExprAgg.cpp:1874:0
#28 0x00007fbea2b70af2
clang::CodeGen::CodeGenFunction::EmitExprAsInit(clang::Expr const*,
clang::ValueDecl const*, clang::CodeGen::LValue, bool)
/home/parallels/code/llvm-project.git/clang/lib/CodeGen/CGDecl.cpp:1921:0
#29 0x00007fbea2b756b5
clang::CodeGen::CodeGenFunction::EmitAutoVarInit(clang::CodeGen::CodeGenFunction::AutoVarEmission
const&)
/home/parallels/code/llvm-project.git/clang/lib/CodeGen/CGDecl.cpp:1860:0
#30 0x00007fbea2b799d2
clang::CodeGen::CodeGenFunction::EmitAutoVarDecl(clang::VarDecl const&)
/home/parallels/code/llvm-project.git/clang/lib/CodeGen/CGDecl.cpp:1286:0
#31 0x00007fbea2b79bdb
clang::CodeGen::CodeGenFunction::EmitVarDecl(clang::VarDecl const&)
/home/parallels/code/llvm-project.git/clang/lib/CodeGen/CGDecl.cpp:200:0
#32 0x00007fbea2b79ef3 clang::Decl::getKind() const
/home/parallels/code/llvm-project.git/clang/include/clang/AST/DeclBase.h:433:0
#33 0x00007fbea2b79ef3 clang::DecompositionDecl::classof(clang::Decl const*)
/home/parallels/code/llvm-project.git/clang/include/clang/AST/DeclCXX.h:3938:0
#34 0x00007fbea2b79ef3 llvm::isa_impl<clang::DecompositionDecl, clang::VarDecl,
void>::doit(clang::VarDecl const&)
/home/parallels/code/llvm-project.git/llvm/include/llvm/Support/Casting.h:58:0
#35 0x00007fbea2b79ef3 llvm::isa_impl_cl<clang::DecompositionDecl,
clang::VarDecl const*>::doit(clang::VarDecl const*)
/home/parallels/code/llvm-project.git/llvm/include/llvm/Support/Casting.h:105:0
#36 0x00007fbea2b79ef3 llvm::isa_impl_wrap<clang::DecompositionDecl,
clang::VarDecl const*, clang::VarDecl const*>::doit(clang::VarDecl const*
const&)
/home/parallels/code/llvm-project.git/llvm/include/llvm/Support/Casting.h:131:0
#37 0x00007fbea2b79ef3 llvm::isa_impl_wrap<clang::DecompositionDecl,
clang::VarDecl const* const, clang::VarDecl const*>::doit(clang::VarDecl const*
const&)
/home/parallels/code/llvm-project.git/llvm/include/llvm/Support/Casting.h:123:0
#38 0x00007fbea2b79ef3 bool llvm::isa<clang::DecompositionDecl, clang::VarDecl
const*>(clang::VarDecl const* const&)
/home/parallels/code/llvm-project.git/llvm/include/llvm/Support/Casting.h:143:0
#39 0x00007fbea2b79ef3 llvm::cast_retty<clang::DecompositionDecl,
clang::VarDecl const*>::ret_type llvm::dyn_cast<clang::DecompositionDecl,
clang::VarDecl const>(clang::VarDecl const*)
/home/parallels/code/llvm-project.git/llvm/include/llvm/Support/Casting.h:345:0
#40 0x00007fbea2b79ef3 clang::CodeGen::CodeGenFunction::EmitDecl(clang::Decl
const&)
/home/parallels/code/llvm-project.git/clang/lib/CodeGen/CGDecl.cpp:145:0
#41 0x00007fbea2cd596f
clang::CodeGen::CodeGenFunction::EmitDeclStmt(clang::DeclStmt const&)
/home/parallels/code/llvm-project.git/clang/lib/CodeGen/CGStmt.cpp:1187:0
#42 0x00007fbea2ce2ff5
clang::CodeGen::CodeGenFunction::EmitSimpleStmt(clang::Stmt const*)
/home/parallels/code/llvm-project.git/clang/lib/CodeGen/CGStmt.cpp:390:0
#43 0x00007fbea2cdea32 clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt
const*, llvm::ArrayRef<clang::Attr const*>)
/home/parallels/code/llvm-project.git/clang/lib/CodeGen/CGStmt.cpp:53:0
#44 0x00007fbea2cdf21c
clang::CodeGen::CodeGenFunction::EmitCompoundStmtWithoutScope(clang::CompoundStmt
const&, bool, clang::CodeGen::AggValueSlot)
/home/parallels/code/llvm-project.git/clang/lib/CodeGen/CGStmt.cpp:453:0
#45 0x00007fbea2d31581
clang::CodeGen::CodeGenFunction::EmitFunctionBody(clang::Stmt const*)
/home/parallels/code/llvm-project.git/clang/lib/CodeGen/CodeGenFunction.cpp:1147:0
#46 0x00007fbea2d3f52d
clang::CodeGen::CodeGenFunction::GenerateCode(clang::GlobalDecl,
llvm::Function*, clang::CodeGen::CGFunctionInfo const&)
/home/parallels/code/llvm-project.git/clang/lib/CodeGen/CodeGenFunction.cpp:1312:0
#47 0x00007fbea2d7f9f0
clang::CodeGen::CodeGenModule::EmitGlobalFunctionDefinition(clang::GlobalDecl,
llvm::GlobalValue*)
/home/parallels/code/llvm-project.git/clang/lib/CodeGen/CodeGenModule.cpp:4528:0
#48 0x00007fbea2d7d3b3
clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl,
llvm::GlobalValue*)
/home/parallels/code/llvm-project.git/clang/lib/CodeGen/CodeGenModule.cpp:2890:0
#49 0x00007fbea2d7dab3
clang::CodeGen::CodeGenModule::EmitGlobal(clang::GlobalDecl)
/home/parallels/code/llvm-project.git/clang/lib/CodeGen/CodeGenModule.cpp:2643:0
#50 0x00007fbea2d83b53
clang::CodeGen::CodeGenModule::EmitTopLevelDecl(clang::Decl*) (.part.6156)
/home/parallels/code/llvm-project.git/clang/lib/CodeGen/CodeGenModule.cpp:5342:0
#51 0x00007fbea2df47ed (anonymous
namespace)::CodeGeneratorImpl::HandleTopLevelDecl(clang::DeclGroupRef)
/home/parallels/code/llvm-project.git/clang/lib/CodeGen/ModuleBuilder.cpp:170:0
#52 0x00007fbea2d24a6d
clang::BackendConsumer::HandleTopLevelDecl(clang::DeclGroupRef)
/home/parallels/code/llvm-project.git/clang/lib/CodeGen/CodeGenAction.cpp:216:0
#53 0x00007fbea1c5a188 clang::ParseAST(clang::Sema&, bool, bool)
/home/parallels/code/llvm-project.git/clang/lib/Parse/ParseAST.cpp:162:0
#54 0x00007fbea2d2dcc8 clang::CodeGenAction::ExecuteAction()
/home/parallels/code/llvm-project.git/clang/lib/CodeGen/CodeGenAction.cpp:1185:0
#55 0x00007fbea3500f29 clang::FrontendAction::Execute()
/home/parallels/code/llvm-project.git/clang/lib/Frontend/FrontendAction.cpp:950:0
#56 0x00007fbea34bd768 llvm::Error::setChecked(bool)
/home/parallels/code/llvm-project.git/llvm/include/llvm/Support/Error.h:305:0
#57 0x00007fbea34bd768 llvm::Error::operator bool()
/home/parallels/code/llvm-project.git/llvm/include/llvm/Support/Error.h:236:0
#58 0x00007fbea34bd768
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
/home/parallels/code/llvm-project.git/clang/lib/Frontend/CompilerInstance.cpp:984:0
#59 0x00007fbea357b24b
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
/home/parallels/code/llvm-project.git/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp:279:0
#60 0x0000561647850f94 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*)
/home/parallels/code/llvm-project.git/clang/tools/driver/cc1_main.cpp:240:0
#61 0x000056164784e013 ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&)
/home/parallels/code/llvm-project.git/clang/tools/driver/driver.cpp:330:0
#62 0x00007fbea31ed765 operator()
/home/parallels/code/llvm-project.git/clang/lib/Driver/Job.cpp:400:0
#63 0x00007fbea31ed765 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/parallels/code/llvm-project.git/llvm/include/llvm/ADT/STLExtras.h:186:0
#64 0x00007fbe9e2df1bc
llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>)
/home/parallels/code/llvm-project.git/llvm/lib/Support/CrashRecoveryContext.cpp:419:0
#65 0x00007fbea31ee5fa
clang::driver::CC1Command::Execute(llvm::ArrayRef<llvm::Optional<llvm::StringRef>
>, std::__cxx11::basic_string<char, std::char_traits<char>,
std::allocator<char> >*, bool*) const (.part.144)
/home/parallels/code/llvm-project.git/clang/lib/Driver/Job.cpp:400:0
#66 0x00007fbea31c8cfa
clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&,
clang::driver::Command const*&) const
/home/parallels/code/llvm-project.git/clang/lib/Driver/Compilation.cpp:195:0
#67 0x00007fbea31c94a3
clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&,
llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*> >&) const
/home/parallels/code/llvm-project.git/clang/lib/Driver/Compilation.cpp:246:0
#68 0x00007fbea31d2cba
clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&,
llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*> >&)
/home/parallels/code/llvm-project.git/clang/lib/Driver/Driver.cpp:1506:0
#69 0x000056164784b659 main
/home/parallels/code/llvm-project.git/clang/tools/driver/driver.cpp:505:0
#70 0x00007fbe9d0682e1 __libc_start_main
(/lib/x86_64-linux-gnu/libc.so.6+0x202e1)
#71 0x000056164784d6ca _start (./bin/clang+0xf6ca)
clang-12: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 12.0.0 (https://github.com/llvm/llvm-project.git
0160ad802e899c2922bc9b29564080c22eb0908c)
Target: avr
Thread model: posix
InstalledDir: /home/parallels/llvm-avr/build/./bin

-- 
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/20200718/39a4d055/attachment-0001.html>


More information about the llvm-bugs mailing list