CTSRD-CHERI / llvm-project

Fork of LLVM adding CHERI support
49 stars 44 forks source link

Assertion failed: (!getType()->isBooleanType() && "unheralded conversion to bool") #657

Open gcjenkinson opened 2 years ago

gcjenkinson commented 2 years ago
Assertion failed: (!getType()->isBooleanType() && "unheralded conversion to bool"), function CastConsistency, file /wrkdirs/usr/ports/devel/llvm-morello/work/llvm-project-0d2a3da490a43b0b78161f0040c3cbf60cb6e07d/clang/lib/AST/Expr.cpp, line 1956.
 #0 0x000000008952f664 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/usr/local64/llvm-morello/lib/libLLVM-13git.so+0x1872664)
 #1 0x000000008952fa68 __assert (/usr/local64/llvm-morello/lib/libLLVM-13git.so+0x1872a68)
 #2 0x0000000084489bc4 clang::CastExpr::CastConsistency(clang::ASTContext const&) const (/usr/local64/llvm-morello/lib/libclang-cpp.so.13git+0x1635bc4)
 #3 0x00000000843101b8 (/usr/local64/llvm-morello/lib/libclang-cpp.so.13git+0x14bc1b8)
 #4 0x000000008448b5f8 clang::ImplicitCastExpr::Create(clang::ASTContext const&, clang::QualType, clang::CastKind, clang::Expr*, llvm::SmallVector<clang::CXXBaseSpecifier*, 4u> const*, clang::ExprValueKind, clang::FPOptionsOverride) (/usr/local64/llvm-morello/lib/libclang-cpp.so.13git+0x16375f8)
 #5 0x000000008493bd90 clang::Sema::ImpCastExprToType(clang::Expr*, clang::QualType, clang::CastKind, clang::ExprValueKind, llvm::SmallVector<clang::CXXBaseSpecifier*, 4u> const*, clang::Sema::CheckedConversionKind) (/usr/local64/llvm-morello/lib/libclang-cpp.so.13git+0x1ae7d90)
 #6 0x0000000084bd1fc0 clang::Sema::UsualUnaryConversions(clang::Expr*) (/usr/local64/llvm-morello/lib/libclang-cpp.so.13git+0x1d7dfc0)
 #7 0x0000000084bd525c clang::Sema::UsualArithmeticConversions(clang::ActionResult<clang::Expr*, true>&, clang::ActionResult<clang::Expr*, true>&, clang::SourceLocation, clang::Sema::ArithConvKind) (/usr/local64/llvm-morello/lib/libclang-cpp.so.13git+0x1d8125c)
 #8 0x0000000084bfca4c clang::Sema::CheckCompareOperands(clang::ActionResult<clang::Expr*, true>&, clang::ActionResult<clang::Expr*, true>&, clang::SourceLocation, clang::BinaryOperatorKind) (/usr/local64/llvm-morello/lib/libclang-cpp.so.13git+0x1da8a4c)
 #9 0x0000000084be5fe0 clang::Sema::CreateBuiltinBinOp(clang::SourceLocation, clang::BinaryOperatorKind, clang::Expr*, clang::Expr*) (/usr/local64/llvm-morello/lib/libclang-cpp.so.13git+0x1d91fe0)
#10 0x0000000084e99684 clang::Sema::CreateOverloadedBinOp(clang::SourceLocation, clang::BinaryOperatorKind, clang::UnresolvedSetImpl const&, clang::Expr*, clang::Expr*, bool, bool, clang::FunctionDecl*) (/usr/local64/llvm-morello/lib/libclang-cpp.so.13git+0x2045684)
#11 0x0000000084c05d0c (/usr/local64/llvm-morello/lib/libclang-cpp.so.13git+0x1db1d0c)
#12 0x0000000084bd4dc4 clang::Sema::ActOnBinOp(clang::Scope*, clang::SourceLocation, clang::tok::TokenKind, clang::Expr*, clang::Expr*) (/usr/local64/llvm-morello/lib/libclang-cpp.so.13git+0x1d80dc4)
#13 0x00000000841d803c clang::Parser::ParseRHSOfBinaryExpression(clang::ActionResult<clang::Expr*, true>, clang::prec::Level) (/usr/local64/llvm-morello/lib/libclang-cpp.so.13git+0x138403c)
#14 0x00000000841d7edc clang::Parser::ParseRHSOfBinaryExpression(clang::ActionResult<clang::Expr*, true>, clang::prec::Level) (/usr/local64/llvm-morello/lib/libclang-cpp.so.13git+0x1383edc)
#15 0x00000000841d7248 clang::Parser::ParseAssignmentExpression(clang::Parser::TypeCastState) (/usr/local64/llvm-morello/lib/libclang-cpp.so.13git+0x1383248)
#16 0x00000000841d704c clang::Parser::ParseExpression(clang::Parser::TypeCastState) (/usr/local64/llvm-morello/lib/libclang-cpp.so.13git+0x138304c)
#17 0x0000000084235ee0 clang::Parser::ParseReturnStatement() (/usr/local64/llvm-morello/lib/libclang-cpp.so.13git+0x13e1ee0)
#18 0x00000000842301a4 clang::Parser::ParseStatementOrDeclarationAfterAttributes(llvm::SmallVector<clang::Stmt*, 32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*, clang::ParsedAttributesWithRange&) (/usr/local64/llvm-morello/lib/libclang-cpp.so.13git+0x13dc1a4)
#19 0x000000008422fbb8 clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector<clang::Stmt*, 32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*) (/usr/local64/llvm-morello/lib/libclang-cpp.so.13git+0x13dbbb8)
#20 0x0000000084237fa4 clang::Parser::ParseCompoundStatementBody(bool) (/usr/local64/llvm-morello/lib/libclang-cpp.so.13git+0x13e3fa4)
#21 0x0000000084238e08 clang::Parser::ParseFunctionStatementBody(clang::Decl*, clang::Parser::ParseScope&) (/usr/local64/llvm-morello/lib/libclang-cpp.so.13git+0x13e4e08)
#22 0x000000008419afd4 clang::Parser::ParseLexedMethodDef(clang::Parser::LexedMethod&) (/usr/local64/llvm-morello/lib/libclang-cpp.so.13git+0x1346fd4)
#23 0x0000000084199d98 clang::Parser::ParseLexedMethodDefs(clang::Parser::ParsingClass&) (/usr/local64/llvm-morello/lib/libclang-cpp.so.13git+0x1345d98)
#24 0x0000000084199d98 clang::Parser::ParseLexedMethodDefs(clang::Parser::ParsingClass&) (/usr/local64/llvm-morello/lib/libclang-cpp.so.13git+0x1345d98)
#25 0x00000000841caa98 clang::Parser::ParseCXXMemberSpecification(clang::SourceLocation, clang::SourceLocation, clang::ParsedAttributesWithRange&, unsigned int, clang::Decl*) (/usr/local64/llvm-morello/lib/libclang-cpp.so.13git+0x1376a98)
#26 0x00000000841c857c clang::Parser::ParseClassSpecifier(clang::tok::TokenKind, clang::SourceLocation, clang::DeclSpec&, clang::Parser::ParsedTemplateInfo const&, clang::AccessSpecifier, bool, clang::Parser::DeclSpecContext, clang::ParsedAttributesWithRange&) (/usr/local64/llvm-morello/lib/libclang-cpp.so.13git+0x137457c)
#27 0x00000000841a9760 clang::Parser::ParseDeclarationSpecifiers(clang::DeclSpec&, clang::Parser::ParsedTemplateInfo const&, clang::AccessSpecifier, clang::Parser::DeclSpecContext, clang::Parser::LateParsedAttrList*) (/usr/local64/llvm-morello/lib/libclang-cpp.so.13git+0x1355760)
#28 0x0000000084251a3c clang::Parser::ParseDeclOrFunctionDefInternal(clang::ParsedAttributesWithRange&, clang::ParsingDeclSpec&, clang::AccessSpecifier) (/usr/local64/llvm-morello/lib/libclang-cpp.so.13git+0x13fda3c)
#29 0x00000000842515fc clang::Parser::ParseDeclarationOrFunctionDefinition(clang::ParsedAttributesWithRange&, clang::ParsingDeclSpec*, clang::AccessSpecifier) (/usr/local64/llvm-morello/lib/libclang-cpp.so.13git+0x13fd5fc)
#30 0x0000000084250644 clang::Parser::ParseExternalDeclaration(clang::ParsedAttributesWithRange&, clang::ParsingDeclSpec*) (/usr/local64/llvm-morello/lib/libclang-cpp.so.13git+0x13fc644)
#31 0x00000000841c1c24 clang::Parser::ParseInnerNamespace(llvm::SmallVector<clang::Parser::InnerNamespaceInfo, 4u> const&, unsigned int, clang::SourceLocation&, clang::ParsedAttributes&, clang::BalancedDelimiterTracker&) (/usr/local64/llvm-morello/lib/libclang-cpp.so.13git+0x136dc24)
#32 0x00000000841c144c clang::Parser::ParseNamespace(clang::DeclaratorContext, clang::SourceLocation&, clang::SourceLocation) (/usr/local64/llvm-morello/lib/libclang-cpp.so.13git+0x136d44c)
#33 0x00000000841a8c4c clang::Parser::ParseDeclaration(clang::DeclaratorContext, clang::SourceLocation&, clang::ParsedAttributesWithRange&, clang::SourceLocation*) (/usr/local64/llvm-morello/lib/libclang-cpp.so.13git+0x1354c4c)
#34 0x00000000842503c8 clang::Parser::ParseExternalDeclaration(clang::ParsedAttributesWithRange&, clang::ParsingDeclSpec*) (/usr/local64/llvm-morello/lib/libclang-cpp.so.13git+0x13fc3c8)
#35 0x00000000841c1c24 clang::Parser::ParseInnerNamespace(llvm::SmallVector<clang::Parser::InnerNamespaceInfo, 4u> const&, unsigned int, clang::SourceLocation&, clang::ParsedAttributes&, clang::BalancedDelimiterTracker&) (/usr/local64/llvm-morello/lib/libclang-cpp.so.13git+0x136dc24)
#36 0x00000000841c144c clang::Parser::ParseNamespace(clang::DeclaratorContext, clang::SourceLocation&, clang::SourceLocation) (/usr/local64/llvm-morello/lib/libclang-cpp.so.13git+0x136d44c)
#37 0x00000000841a8c4c clang::Parser::ParseDeclaration(clang::DeclaratorContext, clang::SourceLocation&, clang::ParsedAttributesWithRange&, clang::SourceLocation*) (/usr/local64/llvm-morello/lib/libclang-cpp.so.13git+0x1354c4c)
#38 0x00000000842503c8 clang::Parser::ParseExternalDeclaration(clang::ParsedAttributesWithRange&, clang::ParsingDeclSpec*) (/usr/local64/llvm-morello/lib/libclang-cpp.so.13git+0x13fc3c8)
#39 0x00000000841c1c24 clang::Parser::ParseInnerNamespace(llvm::SmallVector<clang::Parser::InnerNamespaceInfo, 4u> const&, unsigned int, clang::SourceLocation&, clang::ParsedAttributes&, clang::BalancedDelimiterTracker&) (/usr/local64/llvm-morello/lib/libclang-cpp.so.13git+0x136dc24)
#40 0x00000000841c144c clang::Parser::ParseNamespace(clang::DeclaratorContext, clang::SourceLocation&, clang::SourceLocation) (/usr/local64/llvm-morello/lib/libclang-cpp.so.13git+0x136d44c)
#41 0x00000000841a8c4c clang::Parser::ParseDeclaration(clang::DeclaratorContext, clang::SourceLocation&, clang::ParsedAttributesWithRange&, clang::SourceLocation*) (/usr/local64/llvm-morello/lib/libclang-cpp.so.13git+0x1354c4c)
#42 0x00000000842503c8 clang::Parser::ParseExternalDeclaration(clang::ParsedAttributesWithRange&, clang::ParsingDeclSpec*) (/usr/local64/llvm-morello/lib/libclang-cpp.so.13git+0x13fc3c8)
#43 0x000000008424ed08 clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, bool) (/usr/local64/llvm-morello/lib/libclang-cpp.so.13git+0x13fad08)
#44 0x000000008419723c clang::ParseAST(clang::Sema&, bool, bool) (/usr/local64/llvm-morello/lib/libclang-cpp.so.13git+0x134323c)
#45 0x0000000085c2a010 clang::FrontendAction::Execute() (/usr/local64/llvm-morello/lib/libclang-cpp.so.13git+0x2dd6010)
#46 0x0000000085bca494 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/usr/local64/llvm-morello/lib/libclang-cpp.so.13git+0x2d76494)
#47 0x0000000085c9e9cc clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/usr/local64/llvm-morello/lib/libclang-cpp.so.13git+0x2e4a9cc)
#48 0x0000000000222d7c cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/usr/local64/llvm-morello/bin/clang+++0x222d7c)
#49 0x0000000000220e78 (/usr/local64/llvm-morello/bin/clang+++0x220e78)
#50 0x00000000858e4c70 (/usr/local64/llvm-morello/lib/libclang-cpp.so.13git+0x2a90c70)
#51 0x000000008946dbf8 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/usr/local64/llvm-morello/lib/libLLVM-13git.so+0x17b0bf8)
#52 0x00000000858e46a8 clang::driver::CC1Command::Execute(llvm::ArrayRef<llvm::Optional<llvm::StringRef> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*, bool*) const (/usr/local64/llvm-morello/lib/libclang-cpp.so.13git+0x2a906a8)
#53 0x00000000858bc164 clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&) const (/usr/local64/llvm-morello/lib/libclang-cpp.so.13git+0x2a68164)
#54 0x00000000858bc5a8 clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::__1::pair<int, clang::driver::Command const*> >&) const (/usr/local64/llvm-morello/lib/libclang-cpp.so.13git+0x2a685a8)
#55 0x00000000858cf4e8 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::__1::pair<int, clang::driver::Command const*> >&) (/usr/local64/llvm-morello/lib/libclang-cpp.so.13git+0x2a7b4e8)
PLEASE submit a bug report to https://git.morello-project.org/morello/llvm-project/-/issues and include the crash backtrace, preprocessed source, and associated run script.
If you built clang from source, please provide a reduced test case by running:
    $LLVM_BUILD_DIR/bin/creduce_crash_testcase.py <reproducer>.sh
Stack dump:
0.  Program arguments: /usr/local64/llvm-morello/bin/clang++ -MMD -MF obj/v8/v8_base_without_compiler/module-compiler.o.d -DUSE_AURA=1 -DUSE_OZONE=1 -DOFFICIAL_BUILD -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D_FORTIFY_SOURCE=2 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -DNO_UNWIND_TABLES -D_GNU_SOURCE -DCR_CLANG_REVISION=\"llvmorg-15-init-15652-g89a99ec9-1\" -DNDEBUG -DNVALGRIND -DDYNAMIC_ANNOTATIONS_ENABLED=0 -DV8_TYPED_ARRAY_MAX_SIZE_IN_HEAP=64 -DV8_INTL_SUPPORT -DV8_ATOMIC_OBJECT_FIELD_WRITES -DV8_SHARED_RO_HEAP -DV8_WIN64_UNWINDING_INFO -DV8_ENABLE_REGEXP_INTERPRETER_THREADED_DISPATCH -DV8_ENABLE_CONTROL_FLOW_INTEGRITY -DV8_SHORT_BUILTIN_CALLS -DV8_EXTERNAL_CODE_SPACE -DV8_ENABLE_WEBASSEMBLY -DV8_ALLOCATION_FOLDING -DV8_ALLOCATION_SITE_TRACKING -DV8_ADVANCED_BIGINT_ALGORITHMS -DV8_COMPRESS_POINTERS -DV8_COMPRESS_POINTERS_IN_SHARED_CAGE -DV8_31BIT_SMIS_ON_64BIT_ARCH -DV8_ENABLE_SANDBOX -DV8_SANDBOXED_POINTERS -DV8_DEPRECATION_WARNINGS -DCPPGC_CAGED_HEAP -DCPPGC_YOUNG_GENERATION -DV8_TARGET_ARCH_ARM64 -DV8_HAVE_TARGET_OS -DV8_TARGET_OS_FREEBSD -DV8_TARGET_OS_BSD -DUSING_SYSTEM_ICU=1 -DICU_UTIL_DATA_IMPL=ICU_UTIL_DATA_STATIC -DU_IMPORT=U_EXPORT -I../.. -Igen -I../../v8 -I../../v8/include -Igen/v8 -Igen/v8/include -Igen/shim_headers/icui18n_shim -Igen/shim_headers/icuuc_shim -I../../third_party/zlib -Wall -Wextra -Wimplicit-fallthrough -Wunreachable-code-aggressive -Wthread-safety -Wno-missing-field-initializers -Wno-unused-parameter -Wloop-analysis -Wno-unneeded-internal-declaration -Wenum-compare-conditional -Wno-psabi -Wno-ignored-pragma-optimize -Wshadow -fno-delete-null-pointer-checks -fno-ident -fno-strict-aliasing --param=ssp-buffer-size=4 -fstack-protector -fno-unwind-tables -fno-asynchronous-unwind-tables -fPIC -pthread -fcolor-diagnostics -fmerge-all-constants -mbranch-protection=standard -Xclang -fdebug-compilation-dir -Xclang . -no-canonical-prefixes -fno-omit-frame-pointer -g0 -fvisibility=hidden -Wheader-hygiene -Wstring-conversion -Wtautological-overlap-compare -mbranch-protection=standard -Wmissing-field-initializers -Wno-shadow -Wunreachable-code -Wshorten-64-to-32 -O3 -fdata-sections -ffunction-sections -fno-unique-section-names -Wexit-time-destructors -I/usr/local64/include -I/usr/local64/include -std=c++17 -Wno-trigraphs -fno-exceptions -fno-rtti -fvisibility-inlines-hidden -pipe -g -fstack-protector-strong -isystem /usr/local64/include -fno-strict-aliasing -O0 -march=morello -Xclang -morello-vararg=new -isystem /usr/local64/include -c ../../v8/src/wasm/module-compiler.cc -o obj/v8/v8_base_without_compiler/module-compiler.o
1.  ../../v8/src/wasm/wasm-import-wrapper-cache.h:42:76: current parser token ';'
2.  ../../v8/src/wasm/wasm-import-wrapper-cache.h:15:1: parsing namespace 'v8'
3.  ../../v8/src/wasm/wasm-import-wrapper-cache.h:16:1: parsing namespace 'v8::internal'
4.  ../../v8/src/wasm/wasm-import-wrapper-cache.h:20:1: parsing namespace 'v8::internal::wasm'
5.  ../../v8/src/wasm/wasm-import-wrapper-cache.h:28:1: parsing struct/union/class body 'v8::internal::wasm::WasmImportWrapperCache'
6.  ../../v8/src/wasm/wasm-import-wrapper-cache.h:40:48: parsing function body 'v8::internal::wasm::WasmImportWrapperCache::CacheKey::operator=='
7.  ../../v8/src/wasm/wasm-import-wrapper-cache.h:40:48: in compound statement ('{}')
#0 0x000000008952f664 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/usr/local64/llvm-morello/lib/libLLVM-13git.so+0x1872664)
#1 0x000000008952d83c llvm::sys::RunSignalHandlers() (/usr/local64/llvm-morello/lib/libLLVM-13git.so+0x187083c)
#2 0x000000008946dd00 (/usr/local64/llvm-morello/lib/libLLVM-13git.so+0x17b0d00)
#3 0x000000008946df2c (/usr/local64/llvm-morello/lib/libLLVM-13git.so+0x17b0f2c)
#4 0x000000008121ee98 (/lib/libthr.so.3+0x29e98)
clang++: error: clang frontend command failed with exit code 134 (use -v to see invocation)
clang version 13.0.0
Target: aarch64-unknown-freebsd14.0
Thread model: posix
InstalledDir: /usr/local64/llvm-morello/bin
clang++: note: diagnostic msg:
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang++: note: diagnostic msg: /tmp/module-compiler-0dc53d.cpp
clang++: note: diagnostic msg: /tmp/module-compiler-0dc53d.sh
clang++: note: diagnostic msg:

********************

Attempting to run reduce_crash_test.py hangs here:

===< pass_clang_binsrch :: replace-function-def-with-decl >===

module-compiler-0dc53d.sh.txt module-compiler-0dc53d.cpp.txt

gcjenkinson commented 2 years ago

Looks like this issue:

https://github.com/llvm/llvm-project/issues/56560