-
Notifications
You must be signed in to change notification settings - Fork 14.9k
Closed
Labels
bugzillaIssues migrated from bugzillaIssues migrated from bugzillaclang:frontendLanguage frontend issues, e.g. anything involving "Sema"Language frontend issues, e.g. anything involving "Sema"
Description
Bugzilla Link | 45000 |
Resolution | FIXED |
Resolved on | May 06, 2020 20:10 |
Version | trunk |
OS | All |
Blocks | #44654 |
Attachments | Reduced testcase |
CC | @AaronBallman,@aaronpuchert,@zygoloid,@spavloff,@tstellar |
Fixed by commit(s) | f43859a 9c80516 |
Extended Description
Building current Qt dev branch for mingw targets triggers failed asserts in Clang. This is not a regression, but the same code seems to trigger failed asserts similarly in the last few releases at least. The reduced testcase triggers errors for any target, not only for mingw.
Not sure how it behaves in builds with asserts disabled (working fine i.e. assert incorrect for this case, or triggering undefined behaviours) though.
To reproduce:
$ cat qnetworkaccess-reduced.cpp
struct a {};
struct b {
enum { c };
};
class d {
public:
int e;
int f;
int alignment;
int flags;
int g;
using h = void *;
h i;
};
template <typename> class j {
public:
static d k;
};
template <typename l>
d j<l>::k{0, sizeof(l), alignof(l), b::c, 0, [](a = {}) -> char * {}()};
template <typename> void m() {
using n = int;
j<n>::k;
}
void o() { m<int>; }
$ bin/clang++ -w -c qnetworkaccess-reduced.cpp
clang++: ../tools/clang/lib/CodeGen/CodeGenFunction.h:4411: void clang::CodeGen::CodeGenFunction::EmitCallArgs(clang::CodeGen::CallArgList&, const T*, llvm::iterator_range<clang::Stmt::CastIterator<clang::Expr, const clang::Expr* const, const clang::Stmt* const> >, clang::CodeGen::CodeGenFunction::AbstractCallee, unsigned int, clang::CodeGen::CodeGenFunction::EvaluationOrder) [with T = clang::FunctionProtoType]: Assertion `(isGenericMethod || ((*I)->isVariablyModifiedType() || (*I).getNonReferenceType()->isObjCRetainableType() || getContext() .getCanonicalType((*I).getNonReferenceType()) .getTypePtr() == getContext() .getCanonicalType((*Arg)->getType()) .getTypePtr())) && "type mismatch in call argument!"' failed.
Stack dump:
0. Program arguments: bin/clang++ -w -c qnetworkaccess-reduced.cpp
1. <eof> parser at end of file
2. qnetworkaccess-reduced.cpp:21:26: instantiating function definition 'm<int>'
3. qnetworkaccess-reduced.cpp:17:12: instantiating variable definition 'j<int>::k'
4. qnetworkaccess-reduced.cpp:20:9: Generating code for declaration 'j<int>::k'
#​0 0x000055638a9fbf1a llvm::sys::PrintStackTrace(llvm::raw_ostream&) (bin/clang+++0x4a83f1a)
#​1 0x000055638a9f9974 llvm::sys::RunSignalHandlers() (bin/clang+++0x4a81974)
#​2 0x000055638a9f9be5 llvm::sys::CleanupOnSignal(unsigned long) (bin/clang+++0x4a81be5)
#​3 0x000055638a965bf8 CrashRecoverySignalHandler(int) (bin/clang+++0x49edbf8)
#​4 0x00007f0f1655d890 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x12890)
#​5 0x00007f0f1520ee97 raise /build/glibc-OTsEL5/glibc-2.27/signal/../sysdeps/unix/sysv/linux/raise.c:51:0
#​6 0x00007f0f15210801 abort /build/glibc-OTsEL5/glibc-2.27/stdlib/abort.c:81:0
#​7 0x00007f0f1520039a __assert_fail_base /build/glibc-OTsEL5/glibc-2.27/assert/assert.c:89:0
#​8 0x00007f0f15200412 (/lib/x86_64-linux-gnu/libc.so.6+0x30412)
#​9 0x000055638ad3e3c0 void clang::CodeGen::CodeGenFunction::EmitCallArgs<clang::FunctionProtoType>(clang::CodeGen::CallArgList&, clang::FunctionProtoType const*, llvm::iterator_range<clang::Stmt::CastIterator<clang::Expr, clang::Expr const* const, clang::Stmt const* const> >, clang::CodeGen::CodeGenFunction::AbstractCallee, unsigned int, clang::CodeGen::CodeGenFunction::EvaluationOrder) (bin/clang+++0x4dc63c0)
#​10 0x000055638ad50530 commonEmitCXXMemberOrOperatorCall(clang::CodeGen::CodeGenFunction&, clang::CXXMethodDecl const*, llvm::Value*, llvm::Value*, clang::QualType, clang::CallExpr const*, clang::CodeGen::CallArgList&, clang::CodeGen::CallArgList*) (bin/clang+++0x4dd8530)
#​11 0x000055638ad508c7 clang::CodeGen::CodeGenFunction::EmitCXXMemberOrOperatorCall(clang::CXXMethodDecl const*, clang::CodeGen::CGCallee const&, clang::CodeGen::ReturnValueSlot, llvm::Value*, llvm::Value*, clang::QualType, clang::CallExpr const*, clang::CodeGen::CallArgList*) (bin/clang+++0x4dd88c7)
#​12 0x000055638ad527b0 clang::CodeGen::CodeGenFunction::EmitCXXMemberOrOperatorMemberCallExpr(clang::CallExpr const*, clang::CXXMethodDecl const*, clang::CodeGen::ReturnValueSlot, bool, clang::NestedNameSpecifier*, bool, clang::Expr const*) (bin/clang+++0x4dda7b0)
#​13 0x000055638ad533f2 clang::CodeGen::CodeGenFunction::EmitCXXOperatorMemberCallExpr(clang::CXXOperatorCallExpr const*, clang::CXXMethodDecl const*, clang::CodeGen::ReturnValueSlot) (bin/clang+++0x4ddb3f2)
#​14 0x000055638ada5943 clang::CodeGen::CodeGenFunction::EmitCallExpr(clang::CallExpr const*, clang::CodeGen::ReturnValueSlot) (bin/clang+++0x4e2d943)
#​15 0x000055638ad12766 (anonymous namespace)::ScalarExprEmitter::VisitCallExpr(clang::CallExpr const*) (bin/clang+++0x4d9a766)
#​16 0x000055638ad1097c (anonymous namespace)::ScalarExprEmitter::Visit(clang::Expr*) (bin/clang+++0x4d9897c)
#​17 0x000055638ad1627f (anonymous namespace)::ScalarExprEmitter::VisitCastExpr(clang::CastExpr*) (bin/clang+++0x4d9e27f)
#​18 0x000055638ad11322 (anonymous namespace)::ScalarExprEmitter::Visit(clang::Expr*) (bin/clang+++0x4d99322)
#​19 0x000055638ad11e33 clang::CodeGen::CodeGenFunction::EmitScalarExpr(clang::Expr const*, bool) (bin/clang+++0x4d99e33)
#​20 0x000055638ace320a clang::CodeGen::CodeGenFunction::EmitScalarInit(clang::Expr const*, clang::ValueDecl const*, clang::CodeGen::LValue, bool) (bin/clang+++0x4d6b20a)
#​21 0x000055638adc14bf (anonymous namespace)::AggExprEmitter::EmitInitializationToLValue(clang::Expr*, clang::CodeGen::LValue) (bin/clang+++0x4e494bf)
#​22 0x000055638adc3d75 (anonymous namespace)::AggExprEmitter::VisitInitListExpr(clang::InitListExpr*) (bin/clang+++0x4e4bd75)
#​23 0x000055638adc01d4 (anonymous namespace)::AggExprEmitter::Visit(clang::Expr*) (bin/clang+++0x4e481d4)
#​24 0x000055638adc06a4 (anonymous namespace)::AggExprEmitter::Visit(clang::Expr*) (bin/clang+++0x4e486a4)
#​25 0x000055638adc097e clang::CodeGen::CodeGenFunction::EmitAggExpr(clang::Expr const*, clang::CodeGen::AggValueSlot) (bin/clang+++0x4e4897e)
#​26 0x000055638ae38b85 clang::CodeGen::CodeGenFunction::EmitCXXGlobalVarDeclInit(clang::VarDecl const&, llvm::Constant*, bool) (bin/clang+++0x4ec0b85)
#​27 0x000055638b014921 (anonymous namespace)::ItaniumCXXABI::EmitGuardedInit(clang::CodeGen::CodeGenFunction&, clang::VarDecl const&, llvm::GlobalVariable*, bool) (bin/clang+++0x509c921)
#​28 0x000055638ae39583 clang::CodeGen::CodeGenFunction::GenerateCXXGlobalVarDeclInitFunc(llvm::Function*, clang::VarDecl const*, llvm::GlobalVariable*, bool) (bin/clang+++0x4ec1583)
#​29 0x000055638ae39a0a clang::CodeGen::CodeGenModule::EmitCXXGlobalVarDeclInitFunc(clang::VarDecl const*, llvm::GlobalVariable*, bool) (bin/clang+++0x4ec1a0a)
#​30 0x000055638ac7987b clang::CodeGen::CodeGenModule::EmitGlobalVarDefinition(clang::VarDecl const*, bool) (bin/clang+++0x4d0187b)
#​31 0x000055638ac8e9e1 clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl, llvm::GlobalValue*) (bin/clang+++0x4d169e1)
#​32 0x000055638ac8f3e3 clang::CodeGen::CodeGenModule::EmitGlobal(clang::GlobalDecl) (bin/clang+++0x4d173e3)
#​33 0x000055638ac9588c clang::CodeGen::CodeGenModule::EmitTopLevelDecl(clang::Decl*) (.part.5915) (bin/clang+++0x4d1d88c)
#​34 0x000055638ca9a198 clang::Sema::InstantiateVariableDefinition(clang::SourceLocation, clang::VarDecl*, bool, bool, bool) (bin/clang+++0x6b22198)
#​35 0x000055638ca9ae23 clang::Sema::PerformPendingInstantiations(bool) (bin/clang+++0x6b22e23)
#​36 0x000055638ca9bb38 clang::Sema::InstantiateFunctionDefinition(clang::SourceLocation, clang::FunctionDecl*, bool, bool, bool) (bin/clang+++0x6b23b38)
#​37 0x000055638ca9ac9e clang::Sema::PerformPendingInstantiations(bool) (bin/clang+++0x6b22c9e)
#​38 0x000055638c3eb34b clang::Sema::ActOnEndOfTranslationUnitFragment(clang::Sema::TUFragmentKind) (.part.1380) (bin/clang+++0x647334b)
#​39 0x000055638c3ebaef clang::Sema::ActOnEndOfTranslationUnit() (bin/clang+++0x6473aef)
#​40 0x000055638c308b23 clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, bool) (bin/clang+++0x6390b23)
#​41 0x000055638c2fe799 clang::ParseAST(clang::Sema&, bool, bool) (bin/clang+++0x6386799)
#​42 0x000055638b46a418 clang::CodeGenAction::ExecuteAction() (bin/clang+++0x54f2418)
#​43 0x000055638b3842f9 clang::FrontendAction::Execute() (bin/clang+++0x540c2f9)
#​44 0x000055638b2eb4f2 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (bin/clang+++0x53734f2)
#​45 0x000055638b4444dc clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (bin/clang+++0x54cc4dc)
#​46 0x00005563894d15b4 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (bin/clang+++0x35595b4)
#​47 0x00005563894ca4c9 ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&) (bin/clang+++0x35524c9)
#​48 0x000055638b1cd2a5 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) (bin/clang+++0x52552a5)
#​49 0x000055638a965cd3 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (bin/clang+++0x49edcd3)
#​50 0x000055638b1cdd88 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.147) (bin/clang+++0x5255d88)
#​51 0x000055638b1a7165 clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&) const (bin/clang+++0x522f165)
#​52 0x000055638b1a7c21 clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*> >&) const (bin/clang+++0x522fc21)
#​53 0x000055638b1b02a9 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*> >&) (bin/clang+++0x52382a9)
#​54 0x00005563894cea3f main (bin/clang+++0x3556a3f)
#​55 0x00007f0f151f1b97 __libc_start_main /build/glibc-OTsEL5/glibc-2.27/csu/../csu/libc-start.c:344:0
#​56 0x00005563894ca02a _start (bin/clang+++0x355202a)
clang-11: error: clang frontend command failed due to signal (use -v to see invocation)
clang version 11.0.0 (https://github.com/llvm/llvm-project 82879c2913da69ef2deadee9d075140a84eb6e8c)
Target: x86_64-unknown-linux-gnu
Metadata
Metadata
Assignees
Labels
bugzillaIssues migrated from bugzillaIssues migrated from bugzillaclang:frontendLanguage frontend issues, e.g. anything involving "Sema"Language frontend issues, e.g. anything involving "Sema"