Skip to content

[Clang] Assertion trunk crashes at tryVectorConvertAndSplat(clang::Sema&, clang::ActionResult<clang::Expr*, true>*, clang::QualType, clang::QualType, clang::QualType, unsigned int&)  #108326

Closed
@yijan4845

Description

@yijan4845

Compiler Explorer: https://godbolt.org/z/EW9bxMose

Attempting to compile below program with Clang Assertion Trunk:

typedef _Bool bool4 __attribute__((ext_vector_type(4)));

int main( ) {
    bool4 x = 0;
    x != 0;
}

Stack dump:

clang: /root/llvm-project/clang/lib/AST/Expr.cpp:1928: bool clang::CastExpr::CastConsistency() const: Assertion `!getType()->isBooleanType() && "unheralded conversion to bool"' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0.	Program arguments: /opt/compiler-explorer/clang-assertions-trunk/bin/clang -gdwarf-4 -g -o /app/output.s -mllvm --x86-asm-syntax=intel -fno-verbose-asm -S --gcc-toolchain=/opt/compiler-explorer/gcc-snapshot -fcolor-diagnostics -fno-crash-diagnostics <source>
1.	<source>:5:11: current parser token ';'
2.	<source>:3:13: parsing function body 'main'
3.	<source>:3:13: in compound statement ('{}')
 #0 0x0000000003b2e8d8 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3b2e8d8)
 #1 0x0000000003b2c59c llvm::sys::CleanupOnSignal(unsigned long) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3b2c59c)
 #2 0x0000000003a7ace8 CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0
 #3 0x000073b511842520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #4 0x000073b5118969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
 #5 0x000073b511842476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
 #6 0x000073b5118287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
 #7 0x000073b51182871b (/lib/x86_64-linux-gnu/libc.so.6+0x2871b)
 #8 0x000073b511839e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)
 #9 0x00000000079e84f0 clang::CastExpr::CastConsistency() const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x79e84f0)
#10 0x00000000079e933f clang::ImplicitCastExpr::Create(clang::ASTContext const&, clang::QualType, clang::CastKind, clang::Expr*, llvm::SmallVector<clang::CXXBaseSpecifier*, 4u> const*, clang::ExprValueKind, clang::FPOptionsOverride) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x79e933f)
#11 0x000000000675dd21 clang::Sema::ImpCastExprToType(clang::Expr*, clang::QualType, clang::CastKind, clang::ExprValueKind, llvm::SmallVector<clang::CXXBaseSpecifier*, 4u> const*, clang::CheckedConversionKind) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x675dd21)
#12 0x0000000006b1ec88 tryVectorConvertAndSplat(clang::Sema&, clang::ActionResult<clang::Expr*, true>*, clang::QualType, clang::QualType, clang::QualType, unsigned int&) SemaExpr.cpp:0:0
#13 0x0000000006bbc1c0 clang::Sema::CheckVectorOperands(clang::ActionResult<clang::Expr*, true>&, clang::ActionResult<clang::Expr*, true>&, clang::SourceLocation, bool, bool, bool, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x6bbc1c0)
#14 0x0000000006bbc40f clang::Sema::CheckVectorCompareOperands(clang::ActionResult<clang::Expr*, true>&, clang::ActionResult<clang::Expr*, true>&, clang::SourceLocation, clang::BinaryOperatorKind) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x6bbc40f)
#15 0x0000000006bc57bf clang::Sema::CheckCompareOperands(clang::ActionResult<clang::Expr*, true>&, clang::ActionResult<clang::Expr*, true>&, clang::SourceLocation, clang::BinaryOperatorKind) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x6bc57bf)
#16 0x0000000006bcdb75 clang::Sema::CreateBuiltinBinOp(clang::SourceLocation, clang::BinaryOperatorKind, clang::Expr*, clang::Expr*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x6bcdb75)
#17 0x0000000006bcf2dd clang::Sema::BuildBinOp(clang::Scope*, clang::SourceLocation, clang::BinaryOperatorKind, clang::Expr*, clang::Expr*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x6bcf2dd)
#18 0x0000000006bcfab1 clang::Sema::ActOnBinOp(clang::Scope*, clang::SourceLocation, clang::tok::TokenKind, clang::Expr*, clang::Expr*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x6bcfab1)
#19 0x000000000664e807 clang::Parser::ParseRHSOfBinaryExpression(clang::ActionResult<clang::Expr*, true>, clang::prec::Level) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x664e807)
#20 0x00000000066519c9 clang::Parser::ParseExpression(clang::Parser::TypeCastState) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x66519c9)
#21 0x00000000066d2ff9 clang::Parser::ParseExprStatement(clang::Parser::ParsedStmtContext) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x66d2ff9)
#22 0x00000000066c9ae0 clang::Parser::ParseStatementOrDeclarationAfterAttributes(llvm::SmallVector<clang::Stmt*, 32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*, clang::ParsedAttributes&, clang::ParsedAttributes&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x66c9ae0)
#23 0x00000000066caa10 clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector<clang::Stmt*, 32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x66caa10)
#24 0x00000000066cb8e9 clang::Parser::ParseCompoundStatementBody(bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x66cb8e9)
#25 0x00000000066cd06a clang::Parser::ParseFunctionStatementBody(clang::Decl*, clang::Parser::ParseScope&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x66cd06a)
#26 0x00000000065e0f93 clang::Parser::ParseFunctionDefinition(clang::ParsingDeclarator&, clang::Parser::ParsedTemplateInfo const&, clang::Parser::LateParsedAttrList*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x65e0f93)
#27 0x000000000661661d clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&, clang::DeclaratorContext, clang::ParsedAttributes&, clang::Parser::ParsedTemplateInfo&, clang::SourceLocation*, clang::Parser::ForRangeInit*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x661661d)
#28 0x00000000065d4c4e clang::Parser::ParseDeclOrFunctionDefInternal(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec&, clang::AccessSpecifier) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x65d4c4e)
#29 0x00000000065d53fe clang::Parser::ParseDeclarationOrFunctionDefinition(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*, clang::AccessSpecifier) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x65d53fe)
#30 0x00000000065db987 clang::Parser::ParseExternalDeclaration(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x65db987)
#31 0x00000000065dc85d clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, clang::Sema::ModuleImportState&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x65dc85d)
#32 0x00000000065cfe4a clang::ParseAST(clang::Sema&, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x65cfe4a)
#33 0x000000000447ab58 clang::CodeGenAction::ExecuteAction() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x447ab58)
#34 0x000000000470c0b9 clang::FrontendAction::Execute() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x470c0b9)
#35 0x000000000468f96e clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x468f96e)
#36 0x00000000047f52be clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x47f52be)
#37 0x0000000000cbcb7f cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0xcbcb7f)
#38 0x0000000000cb5dca ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) driver.cpp:0:0
#39 0x00000000044bdfb9 void llvm::function_ref<void ()>::callback_fn<clang::driver::CC1Command::Execute(llvm::ArrayRef<std::optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const::'lambda'()>(long) Job.cpp:0:0
#40 0x0000000003a7b194 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3a7b194)
#41 0x00000000044be5af clang::driver::CC1Command::Execute(llvm::ArrayRef<std::optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const (.part.0) Job.cpp:0:0
#42 0x00000000044844b5 clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x44844b5)
#43 0x0000000004484f1d clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&, bool) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x4484f1d)
#44 0x000000000448cb65 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x448cb65)
#45 0x0000000000cb9f75 clang_main(int, char**, llvm::ToolContext const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0xcb9f75)
#46 0x0000000000b8bc84 main (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0xb8bc84)
#47 0x000073b511829d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#48 0x000073b511829e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#49 0x0000000000cb587e _start (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0xcb587e)
clang: error: clang frontend command failed with exit code 134 (use -v to see invocation)
Compiler returned: 134

Metadata

Metadata

Assignees

No one assigned

    Labels

    clang:frontendLanguage frontend issues, e.g. anything involving "Sema"confirmedVerified by a second partycrashPrefer [crash-on-valid] or [crash-on-invalid]

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions