swiftlang / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies. This fork is used to manage Swift’s stable releases of Clang as well as support the Swift project.
https://llvm.org
Other
1.12k stars 330 forks source link

Assertion failed: (reinterpret_cast<uintptr_t>(Buckets) & 0x3) == 0 && "buckets should be 4-byte aligned.", file S:\SourceCache\swift-project\llvm-project\llvm\include\llvm/Support/OnDiskHashTable.h, line 305 #7172

Open compnerd opened 1 year ago

compnerd commented 1 year ago

Reproduces with swift build -Xcc -IS:\b\1\include -Xcc -IS:\b\1\tools\clang\include -Xcc -IS:\b\1\tools\swift\include -Xcc -std=c++17

at apple/swift@85e38afbac07df01e9041dd274fc62be4febfffb

Assertion failed: (reinterpret_cast<uintptr_t>(Buckets) & 0x3) == 0 && "buckets should be 4-byte aligned.", file S:\SourceCache\swift-project\llvm-project\llvm\include\llvm/Support/OnDiskHashTable.h, line 305
Please submit a bug report (https://swift.org/contributing/#reporting-bugs) and include the crash backtrace.
Stack dump:
0.      ../include\swift/AST/ClangModuleLoader.h:19:2: current parser token 'include'
1.      ../include\swift/Basic/TaggedUnion.h:23:1: parsing namespace 'swift'
Exception Code: 0x80000003
 #0 0x00007ff6a78fea25 llvm::SmallVectorBase<unsigned __int64>::{ctor} S:\SourceCache\swift-project\llvm-project\llvm\include\llvm\ADT\SmallVector.h:64:0
 #1 0x00007ff6a78fea25 llvm::SmallVectorTemplateCommon<char,void>::{ctor} S:\SourceCache\swift-project\llvm-project\llvm\include\llvm\ADT\SmallVector.h:138:0
 #2 0x00007ff6a78fea25 llvm::SmallVectorTemplateBase<char,1>::{ctor} S:\SourceCache\swift-project\llvm-project\llvm\include\llvm\ADT\SmallVector.h:491:0
 #3 0x00007ff6a78fea25 llvm::SmallVectorImpl<char>::{ctor} S:\SourceCache\swift-project\llvm-project\llvm\include\llvm\ADT\SmallVector.h:592:0
 #4 0x00007ff6a78fea25 llvm::SmallVector<char,32>::{ctor} S:\SourceCache\swift-project\llvm-project\llvm\include\llvm\ADT\SmallVector.h:1202:0
 #5 0x00007ff6a78fea25 llvm::SmallString<32>::{ctor} S:\SourceCache\swift-project\llvm-project\llvm\include\llvm\ADT\SmallString.h:29:0
 #6 0x00007ff6a78fea25 printSymbolizedStackTrace S:\SourceCache\swift-project\llvm-project\llvm\lib\Support\Signals.cpp:181:0
 #7 0x00007ffd7c66e5f5 (C:\Windows\System32\ucrtbase.dll+0x7e5f5)
 #8 0x00007ffd7c66f601 (C:\Windows\System32\ucrtbase.dll+0x7f601)
 #9 0x00007ffd7c67106a (C:\Windows\System32\ucrtbase.dll+0x8106a)
#10 0x00007ffd7c670f5d (C:\Windows\System32\ucrtbase.dll+0x80f5d)
#11 0x00007ffd7c6711f1 (C:\Windows\System32\ucrtbase.dll+0x811f1)
#12 0x00007ff6a5d81ffb clang::ASTReader::ReadASTBlock(class clang::serialization::ModuleFile &, unsigned int) S:\SourceCache\swift-project\llvm-project\clang\lib\Serialization\ASTReader.cpp:3429:0
#13 0x00007ff6a5d7ec3d std::allocator<char>::deallocate C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.36.32532\include\xmemory:946:0
#14 0x00007ff6a5d7ec3d std::basic_string<char,std::char_traits<char>,std::allocator<char> >::_Tidy_deallocate C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.36.32532\include\xstring:4874:0
#15 0x00007ff6a5d7ec3d std::basic_string<char,std::char_traits<char>,std::allocator<char> >::{dtor} C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.36.32532\include\xstring:3157:0
#16 0x00007ff6a5d7ec3d clang::ASTReader::ParseTargetOptions(class llvm::SmallVector<unsigned __int64, 64> const &, bool, class clang::ASTReaderListener &, bool) S:\SourceCache\swift-project\llvm-project\clang\lib\Serialization\ASTReader.cpp:5899:0
#17 0x00007ff6a5a4b71d clang::CompilerInstance::getDiagnostics S:\SourceCache\swift-project\llvm-project\clang\include\clang\Frontend\CompilerInstance.h:381:0
#18 0x00007ff6a5a4b71d clang::CompilerInstance::createTarget(void) S:\SourceCache\swift-project\llvm-project\clang\lib\Frontend\CompilerInstance.cpp:122:0
#19 0x00007ff6a5a4dd19 clang::DiagnosticBuilder::Clear S:\SourceCache\swift-project\llvm-project\clang\include\clang\Basic\Diagnostic.h:1301:0
#20 0x00007ff6a5a4dd19 clang::DiagnosticBuilder::Emit S:\SourceCache\swift-project\llvm-project\clang\include\clang\Basic\Diagnostic.h:1324:0
#21 0x00007ff6a5a4dd19 clang::DiagnosticBuilder::{dtor} S:\SourceCache\swift-project\llvm-project\clang\include\clang\Basic\Diagnostic.h:1362:0
#22 0x00007ff6a5a4dd19 loadAPINotesFromIncludeTree S:\SourceCache\swift-project\llvm-project\clang\lib\Frontend\CompilerInstance.cpp:824:0
#23 0x00007ff6a76f18f4 clang::Preprocessor::HandleElifFamilyDirective(class clang::Token &, class clang::Token const &, enum clang::tok::PPKeywordKind) S:\SourceCache\swift-project\llvm-project\clang\lib\Lex\PPDirectives.cpp:3586:0
#24 0x00007ff6a76f3b7b clang::DiagnosticBuilder::Clear S:\SourceCache\swift-project\llvm-project\clang\include\clang\Basic\Diagnostic.h:1301:0
#25 0x00007ff6a76f3b7b clang::DiagnosticBuilder::Emit S:\SourceCache\swift-project\llvm-project\clang\include\clang\Basic\Diagnostic.h:1324:0
#26 0x00007ff6a76f3b7b clang::DiagnosticBuilder::{dtor} S:\SourceCache\swift-project\llvm-project\clang\include\clang\Basic\Diagnostic.h:1362:0
#27 0x00007ff6a76f3b7b clang::Preprocessor::HandleIdentSCCSDirective(class clang::Token &) S:\SourceCache\swift-project\llvm-project\clang\lib\Lex\PPDirectives.cpp:1668:0
#28 0x00007ff6a76f02f1 clang::DiagnosticBuilder::{dtor} S:\SourceCache\swift-project\llvm-project\clang\include\clang\Basic\Diagnostic.h:1362:0
#29 0x00007ff6a76f02f1 clang::Preprocessor::HandleDefineDirective(class clang::Token &, bool) S:\SourceCache\swift-project\llvm-project\clang\lib\Lex\PPDirectives.cpp:3215:0
#30 0x00007ff6a76a3181 clang::Lexer::LexTokenInternal(class clang::Token &, bool) S:\SourceCache\swift-project\llvm-project\clang\lib\Lex\Lexer.cpp:3738:0
#31 0x00007ff6a769ef15 clang::Lexer::Create_PragmaLexer(class clang::SourceLocation, class clang::SourceLocation, class clang::SourceLocation, unsigned int, class clang::Preprocessor &) S:\SourceCache\swift-project\llvm-project\clang\lib\Lex\Lexer.cpp:204:0
#32 0x00007ff6a76aff2c clang::Token::is S:\SourceCache\swift-project\llvm-project\clang\include\clang\Lex\Token.h:97:0
#33 0x00007ff6a76aff2c clang::Preprocessor::FinishLexStringLiteral(class clang::Token &, class std::basic_string<char, struct std::char_traits<char>, class std::allocator<char>> &, char const *, bool) S:\SourceCache\swift-project\llvm-project\clang\lib\Lex\Preprocessor.cpp:1367:0
#34 0x00007ff6a5c5d2f1 std::default_delete<clang::PragmaHandler>::operator() C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.36.32532\include\memory:3167:0
#35 0x00007ff6a5c5d2f1 std::unique_ptr<clang::PragmaHandler,std::default_delete<clang::PragmaHandler> >::{dtor} C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.36.32532\include\memory:3278:0
#36 0x00007ff6a5c5d2f1 clang::Parser::~Parser(void) S:\SourceCache\swift-project\llvm-project\clang\lib\Parse\Parser.cpp:478:0
#37 0x00007ff6a5c67d32 clang::OpaquePtr<clang::QualType>::operator bool S:\SourceCache\swift-project\llvm-project\clang\include\clang\Sema\Ownership.h:88:0
#38 0x00007ff6a5c67d32 clang::Parser::TryAnnotateTypeOrScopeTokenAfterScopeSpec(class clang::CXXScopeSpec &, bool, enum clang::ImplicitTypenameContext) S:\SourceCache\swift-project\llvm-project\clang\lib\Parse\Parser.cpp:2065:0
#39 0x00007ff6a5cfbf71 clang::ActionResult<clang::Expr *,1>::isInvalid S:\SourceCache\swift-project\llvm-project\clang\include\clang\Sema\Ownership.h:207:0
#40 0x00007ff6a5cfbf71 clang::Parser::ParseDecltypeSpecifier(class clang::DeclSpec &) S:\SourceCache\swift-project\llvm-project\clang\lib\Parse\ParseDeclCXX.cpp:1133:0
#41 0x00007ff6a5cffa85 clang::Parser::ParseNamespace(enum clang::DeclaratorContext, class clang::SourceLocation &, class clang::SourceLocation) S:\SourceCache\swift-project\llvm-project\clang\lib\Parse\ParseDeclCXX.cpp:121:0
#42 0x00007ff6a5c865e2 clang::Parser::ParseDeclGroup(class clang::ParsingDeclSpec &, enum clang::DeclaratorContext, class clang::ParsedAttributes &, class clang::SourceLocation *, struct clang::Parser::ForRangeInit *) S:\SourceCache\swift-project\llvm-project\clang\lib\Parse\ParseDecl.cpp:2200:0
#43 0x00007ff6a5c60518 clang::Parser::ParseDeclOrFunctionDefInternal(class clang::ParsedAttributes &, class clang::ParsedAttributes &, class clang::ParsingDeclSpec &, enum clang::AccessSpecifier) S:\SourceCache\swift-project\llvm-project\clang\lib\Parse\Parser.cpp:1164:0
#44 0x00007ff6a5c65066 clang::Parser::ParseModuleImport(class clang::SourceLocation, enum clang::Sema::ModuleImportState &) S:\SourceCache\swift-project\llvm-project\clang\lib\Parse\Parser.cpp:2590:0
#45 0x00007ff6a5c69620 clang::Parser::handleUnexpectedCodeCompletionToken(void) S:\SourceCache\swift-project\llvm-project\clang\lib\Parse\Parser.cpp:2221:0
#46 0x00007ff6a5ab0dd0 std::_Tree<std::_Tmap_traits<std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::vector<std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::allocator<std::basic_string<char,std::char_traits<char>,std::allocator<char> > > >,std::less<std::basic_string<char,std::char_traits<char>,std::allocator<char> > >,std::allocator<std::pair<std::basic_string<char,std::char_traits<char>,std::allocator<char> > const ,std::vector<std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::allocator<std::basic_string<char,std::char_traits<char>,std::allocator<char> > > > > >,0> >::_Check_grow_by_1 C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.36.32532\include\xtree:1629:0
#47 0x00007ff6a5ab0dd0 std::map<std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::vector<std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::allocator<std::basic_string<char,std::char_traits<char>,std::allocator<char> > > >,std::less<std::basic_string<char,std::char_traits<char>,std::allocator<char> > >,std::allocator<std::pair<std::basic_string<char,std::char_traits<char>,std::allocator<char> > const ,std::vector<std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::allocator<std::basic_string<char,std::char_traits<char>,std::allocator<char> > > > > > >::_Try_emplace C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.36.32532\include\map:196:0
#48 0x00007ff6a5ab0dd0 std::map<std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::vector<std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::allocator<std::basic_string<char,std::char_traits<char>,std::allocator<char> > > >,std::less<std::basic_string<char,std::char_traits<char>,std::allocator<char> > >,std::allocator<std::pair<std::basic_string<char,std::char_traits<char>,std::allocator<char> > const ,std::vector<std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::allocator<std::basic_string<char,std::char_traits<char>,std::allocator<char> > > > > > >::operator[] C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.36.32532\include\map:174:0
#49 0x00007ff6a5ab0dd0 clang::FrontendAction::CreateWrappedASTConsumer(class clang::CompilerInstance &, class llvm::StringRef) S:\SourceCache\swift-project\llvm-project\clang\lib\Frontend\FrontendAction.cpp:211:0
#50 0x00007ff6a5ab0bbe std::default_delete<clang::PluginASTAction>::operator() C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.36.32532\include\memory:3167:0
#51 0x00007ff6a5ab0bbe std::unique_ptr<clang::PluginASTAction,std::default_delete<clang::PluginASTAction> >::{dtor} C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.36.32532\include\memory:3278:0
#52 0x00007ff6a5ab0bbe clang::FrontendAction::CreateWrappedASTConsumer(class clang::CompilerInstance &, class llvm::StringRef) S:\SourceCache\swift-project\llvm-project\clang\lib\Frontend\FrontendAction.cpp:222:0
#53 0x00007ff6a5a41503 clang::ChainedDiagnosticConsumer::`scalar deleting dtor'(unsigned int) (S:\Library\Developer\Toolchains\unknown-Asserts-development.xctoolchain\usr\bin\swift-frontend.exe+0x39c1503)
#54 0x00007ff6a5a3ea40 clang::cas::CompileJobResultSchema::load(class llvm::cas::ObjectRef) const S:\SourceCache\swift-project\llvm-project\clang\lib\Frontend\CompileJobCacheResult.cpp:176:0
#55 0x00007ff6a78daec4 hasher_push_cv S:\SourceCache\swift-project\llvm-project\llvm\lib\Support\BLAKE3\blake3.c:457:0
#56 0x00007ff6a78daec4 llvm_blake3_hasher_update S:\SourceCache\swift-project\llvm-project\llvm\lib\Support\BLAKE3\blake3.c:550:0
#57 0x00007ff6a78db05f llvm_blake3_hasher_update S:\SourceCache\swift-project\llvm-project\llvm\lib\Support\BLAKE3\blake3.c:551:0
#58 0x00007ff6a78dabbf compress_parents_parallel S:\SourceCache\swift-project\llvm-project\llvm\lib\Support\BLAKE3\blake3.c:230:0
#59 0x00007ff6a78dabbf compress_subtree_to_parent_node S:\SourceCache\swift-project\llvm-project\llvm\lib\Support\BLAKE3\blake3.c:362:0
#60 0x00007ff6a78dabbf llvm_blake3_hasher_update S:\SourceCache\swift-project\llvm-project\llvm\lib\Support\BLAKE3\blake3.c:547:0
#61 0x00007ffd7c619363 (C:\Windows\System32\ucrtbase.dll+0x29363)
#62 0x00007ffd7d7a26ad (C:\Windows\System32\KERNEL32.DLL+0x126ad)
#63 0x00007ffd7ea2aa68 (C:\Windows\SYSTEM32\ntdll.dll+0x5aa68)
hyp commented 1 year ago

Happens because we embed the module inside of a COFF file, which doesn't seem to align the module well :)

Workaround:

-Xcc -Xclang -Xcc -fmodule-format=raw