- Notifications
You must be signed in to change notification settings - Fork 15.3k
Closed
Closed
Copy link
Labels
clang:frontendLanguage frontend issues, e.g. anything involving "Sema"Language frontend issues, e.g. anything involving "Sema"crashPrefer [crash-on-valid] or [crash-on-invalid]Prefer [crash-on-valid] or [crash-on-invalid]
Description
LLVM revision: eef35c287ee0
I was trying to build Swift with clang, but clang crashes with the following error.
(Originally, I ran clang with Chromium's clang and got a crash. So I tried to build clang by myself and run it, but it still crashes.)
$ /home/leebc/src/oss/llvm-project/build-clang/bin/clang++ -DCMARK_STATIC_DEFINE -DGTEST_HAS_RTTI=0 -DSWIFT_LLVM_SUPPORT_IS_AVAILABLE -DSWIFT_THREADING_LINUX -D_DEBUG -D_GLIBCXX_ASSERTIONS -D_LIBCPP_ENABLE_ASSERTIONS -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/home/leebc/src/oss/swift/build/buildbot_linux/swift-linux-x86_64/lib/AST -I/home/leebc/src/oss/swift/swift/lib/AST -I/home/leebc/src/oss/swift/swift/stdlib/public/SwiftShims -I/home/leebc/src/oss/swift/build/buildbot_linux/swift-linux-x86_64/include -I/home/leebc/src/oss/swift/swift/include -I/home/leebc/src/oss/swift/llvm-project/llvm/include -I/home/leebc/src/oss/swift/build/buildbot_linux/llvm-linux-x86_64/include -I/home/leebc/src/oss/swift/llvm-project/clang/include -I/home/leebc/src/oss/swift/build/buildbot_linux/llvm-linux-x86_64/tools/clang/include -I/home/leebc/src/oss/swift/cmark/src/include -I/home/leebc/src/oss/swift/build/buildbot_linux/cmark-linux-x86_64/src -I/home/leebc/src/oss/swift/swift-corelibs-libdispatch/src/BlocksRuntime -I/home/leebc/src/oss/swift/swift-corelibs-libdispatch -Wno-unknown-warning-option -Werror=unguarded-availability-new -fno-stack-protector -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -Wimplicit-fallthrough -Wcovered-switch-default -Wno-class-memaccess -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wmisleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -Werror=switch -Wdocumentation -Wimplicit-fallthrough -Wunreachable-code -Woverloaded-virtual -DOBJC_OLD_DISPATCH_PROTOTYPES=0 -O3 -DNDEBUG -std=c++17 -fno-exceptions -fno-rtti -Werror=gnu -Werror=c++98-compat-extra-semi -UNDEBUG -target x86_64-unknown-linux-gnu -O2 -g0 -march=core2 -MD -MT lib/AST/CMakeFiles/swiftAST.dir/ASTContext.cpp.o -MF lib/AST/CMakeFiles/swiftAST.dir/ASTContext.cpp.o.d -o lib/AST/CMakeFiles/swiftAST.dir/ASTContext.cpp.o -c /home/leebc/src/oss/swift/swift/lib/AST/ASTContext.cpp In file included from /home/leebc/src/oss/swift/swift/lib/AST/ASTContext.cpp:17: In file included from /home/leebc/src/oss/swift/swift/include/swift/AST/ASTContext.h:22: In file included from /home/leebc/src/oss/swift/swift/include/swift/AST/GenericSignature.h:20: /home/leebc/src/oss/swift/swift/include/swift/AST/PrintOptions.h:585:33: warning: '\c' command has no word arguments, expected 1 [-Wdocumentation] 585 | /// Whether or not to print \c @attached(extension) attributes on | ~~^ 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: /home/leebc/src/oss/llvm-project/build-clang/bin/clang++ -DCMARK_STATIC_DEFINE -DGTEST_HAS_RTTI=0 -DSWIFT_LLVM_SUPPORT_IS_AVAILABLE -DSWIFT_THREADING_LINUX -D_DEBUG -D_GLIBCXX_ASSERTIONS -D_LIBCPP_ENABLE_ASSERTIONS -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/home/leebc/src/oss/swift/build/buildbot_linux/swift-linux-x86_64/lib/AST -I/home/leebc/src/oss/swift/swift/lib/AST -I/home/leebc/src/oss/swift/swift/stdlib/public/SwiftShims -I/home/leebc/src/oss/swift/build/buildbot_linux/swift-linux-x86_64/include -I/home/leebc/src/oss/swift/swift/include -I/home/leebc/src/oss/swift/llvm-project/llvm/include -I/home/leebc/src/oss/swift/build/buildbot_linux/llvm-linux-x86_64/include -I/home/leebc/src/oss/swift/llvm-project/clang/include -I/home/leebc/src/oss/swift/build/buildbot_linux/llvm-linux-x86_64/tools/clang/include -I/home/leebc/src/oss/swift/cmark/src/include -I/home/leebc/src/oss/swift/build/buildbot_linux/cmark-linux-x86_64/src -I/home/leebc/src/oss/swift/swift-corelibs-libdispatch/src/BlocksRuntime -I/home/leebc/src/oss/swift/swift-corelibs-libdispatch -Wno-unknown-warning-option -Werror=unguarded-availability-new -fno-stack-protector -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -Wimplicit-fallthrough -Wcovered-switch-default -Wno-class-memaccess -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wmisleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -Werror=switch -Wdocumentation -Wimplicit-fallthrough -Wunreachable-code -Woverloaded-virtual -DOBJC_OLD_DISPATCH_PROTOTYPES=0 -O3 -DNDEBUG -std=c++17 -fno-exceptions -fno-rtti -Werror=gnu -Werror=c++98-compat-extra-semi -UNDEBUG -target x86_64-unknown-linux-gnu -O2 -g0 -march=core2 -MD -MT lib/AST/CMakeFiles/swiftAST.dir/ASTContext.cpp.o -MF lib/AST/CMakeFiles/swiftAST.dir/ASTContext.cpp.o.d -o lib/AST/CMakeFiles/swiftAST.dir/ASTContext.cpp.o -c /home/leebc/src/oss/swift/swift/lib/AST/ASTContext.cpp 1. <eof> parser at end of file 2. /home/leebc/src/oss/swift/llvm-project/clang/include/clang/AST/Redeclarable.h:189:14: instantiating function definition 'clang::Redeclarable<clang::TranslationUnitDecl>::getNextRedeclaration' 3. /home/leebc/src/oss/swift/llvm-project/clang/include/clang/AST/Redeclarable.h:122:16: instantiating function definition 'clang::Redeclarable<clang::TranslationUnitDecl>::DeclLink::getPrevious' 4. /home/leebc/src/oss/swift/llvm-project/clang/include/clang/AST/ExternalASTSource.h:410:12: instantiating function definition 'clang::LazyGenerationalUpdatePtr<const clang::Decl *, clang::Decl *, &clang::ExternalASTSource::CompleteRedeclChain>::LazyGenerationalUpdatePtr' 5. /home/leebc/src/oss/swift/llvm-project/clang/include/clang/AST/ASTContext.h:3508:57: instantiating function definition 'clang::LazyGenerationalUpdatePtr<const clang::Decl *, clang::Decl *, &clang::ExternalASTSource::CompleteRedeclChain>::makeValue' #0 0x00000000045dc372 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) /home/leebc/src/oss/llvm-project/llvm/lib/Support/Unix/Signals.inc:723:22 #1 0x00000000045dc7ab PrintStackTraceSignalHandler(void*) /home/leebc/src/oss/llvm-project/llvm/lib/Support/Unix/Signals.inc:798:1 #2 0x00000000045d9f2e llvm::sys::RunSignalHandlers() /home/leebc/src/oss/llvm-project/llvm/lib/Support/Signals.cpp:105:20 #3 0x00000000045dbc5c llvm::sys::CleanupOnSignal(unsigned long) /home/leebc/src/oss/llvm-project/llvm/lib/Support/Unix/Signals.inc:367:31 #4 0x00000000045138ac (anonymous namespace)::CrashRecoveryContextImpl::HandleCrash(int, unsigned long) /home/leebc/src/oss/llvm-project/llvm/lib/Support/CrashRecoveryContext.cpp:73:5 #5 0x0000000004513d3b CrashRecoverySignalHandler(int) /home/leebc/src/oss/llvm-project/llvm/lib/Support/CrashRecoveryContext.cpp:391:1 #6 0x00007f5d54d7ebb0 __restore_rt (/lib64/libc.so.6+0x3dbb0) #7 0x000000000455a9c5 llvm::StringRef::find_last_of(llvm::StringRef, unsigned long) const /home/leebc/src/oss/llvm-project/llvm/lib/Support/StringRef.cpp:282:44 #8 0x00000000097c2568 clang::ASTContext::getRawCommentForDeclNoCacheImpl(clang::Decl const*, clang::SourceLocation, std::map<unsigned int, clang::RawComment*, std::less<unsigned int>, std::allocator<std::pair<unsigned int const, clang::RawComment*>>> const&) const /home/leebc/src/oss/llvm-project/clang/lib/AST/ASTContext.cpp:353:34 #9 0x00000000097c3366 clang::ASTContext::attachCommentsToJustParsedDecls(llvm::ArrayRef<clang::Decl*>, clang::Preprocessor const*) /home/leebc/src/oss/llvm-project/clang/lib/AST/ASTContext.cpp:604:44 #10 0x00000000083e7d86 clang::Sema::ActOnDocumentableDecls(llvm::ArrayRef<clang::Decl*>) /home/leebc/src/oss/llvm-project/clang/lib/Sema/SemaDecl.cpp:14880:42 #11 0x00000000083e7c04 clang::Sema::ActOnDocumentableDecl(clang::Decl*) /home/leebc/src/oss/llvm-project/clang/lib/Sema/SemaDecl.cpp:14850:1 #12 0x00000000083eb50d clang::Sema::ActOnStartOfFunctionDef(clang::Scope*, clang::Decl*, clang::Sema::SkipBodyInfo*, clang::Sema::FnBodyKind) /home/leebc/src/oss/llvm-project/clang/lib/Sema/SemaDecl.cpp:15658:46 #13 0x000000000912ea46 clang::Sema::InstantiateFunctionDefinition(clang::SourceLocation, clang::FunctionDecl*, bool, bool, bool) /home/leebc/src/oss/llvm-project/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp:5135:51 #14 0x00000000091331aa clang::Sema::PerformPendingInstantiations(bool) /home/leebc/src/oss/llvm-project/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp:6425:32 #15 0x0000000009186177 clang::Sema::GlobalEagerInstantiationScope::perform() /home/leebc/src/oss/llvm-project/clang/include/clang/Sema/Sema.h:10064:5 #16 0x000000000912edfb clang::Sema::InstantiateFunctionDefinition(clang::SourceLocation, clang::FunctionDecl*, bool, bool, bool) /home/leebc/src/oss/llvm-project/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp:5189:1 #17 0x00000000091331aa clang::Sema::PerformPendingInstantiations(bool) /home/leebc/src/oss/llvm-project/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp:6425:32 #18 0x0000000009186177 clang::Sema::GlobalEagerInstantiationScope::perform() /home/leebc/src/oss/llvm-project/clang/include/clang/Sema/Sema.h:10064:5 #19 0x000000000912edfb clang::Sema::InstantiateFunctionDefinition(clang::SourceLocation, clang::FunctionDecl*, bool, bool, bool) /home/leebc/src/oss/llvm-project/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp:5189:1 #20 0x00000000091331aa clang::Sema::PerformPendingInstantiations(bool) /home/leebc/src/oss/llvm-project/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp:6425:32 #21 0x0000000009186177 clang::Sema::GlobalEagerInstantiationScope::perform() /home/leebc/src/oss/llvm-project/clang/include/clang/Sema/Sema.h:10064:5 #22 0x000000000912edfb clang::Sema::InstantiateFunctionDefinition(clang::SourceLocation, clang::FunctionDecl*, bool, bool, bool) /home/leebc/src/oss/llvm-project/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp:5189:1 #23 0x00000000091331aa clang::Sema::PerformPendingInstantiations(bool) /home/leebc/src/oss/llvm-project/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp:6425:32 #24 0x00000000081506e1 clang::Sema::ActOnEndOfTranslationUnitFragment(clang::Sema::TUFragmentKind) /home/leebc/src/oss/llvm-project/clang/lib/Sema/Sema.cpp:1083:3 #25 0x0000000008150a85 clang::Sema::ActOnEndOfTranslationUnit() /home/leebc/src/oss/llvm-project/clang/lib/Sema/Sema.cpp:1124:9 #26 0x0000000007fc1f4c clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, clang::Sema::ModuleImportState&) /home/leebc/src/oss/llvm-project/clang/lib/Parse/Parser.cpp:716:12 #27 0x0000000007fbd3cf clang::ParseAST(clang::Sema&, bool, bool) /home/leebc/src/oss/llvm-project/clang/lib/Parse/ParseAST.cpp:163:37 #28 0x0000000005507d70 clang::ASTFrontendAction::ExecuteAction() /home/leebc/src/oss/llvm-project/clang/lib/Frontend/FrontendAction.cpp:1184:11 #29 0x0000000005f38cd3 clang::CodeGenAction::ExecuteAction() /home/leebc/src/oss/llvm-project/clang/lib/CodeGen/CodeGenAction.cpp:1208:5 #30 0x00000000055076c1 clang::FrontendAction::Execute() /home/leebc/src/oss/llvm-project/clang/lib/Frontend/FrontendAction.cpp:1074:38 #31 0x0000000005434768 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) /home/leebc/src/oss/llvm-project/clang/lib/Frontend/CompilerInstance.cpp:1045:42 #32 0x000000000569994a clang::ExecuteCompilerInvocation(clang::CompilerInstance*) /home/leebc/src/oss/llvm-project/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp:272:38 #33 0x0000000000d69dec cc1_main(llvm::ArrayRef<char const*>, char const*, void*) /home/leebc/src/oss/llvm-project/clang/tools/driver/cc1_main.cpp:294:40 #34 0x0000000000d5ad5e ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) /home/leebc/src/oss/llvm-project/clang/tools/driver/driver.cpp:366:20 #35 0x0000000000d5af4b clang_main(int, char**, llvm::ToolContext const&)::'lambda'(llvm::SmallVectorImpl<char const*>&)::operator()(llvm::SmallVectorImpl<char const*>&) const /home/leebc/src/oss/llvm-project/clang/tools/driver/driver.cpp:507:5 #36 0x0000000000d5c547 int llvm::function_ref<int (llvm::SmallVectorImpl<char const*>&)>::callback_fn<clang_main(int, char**, llvm::ToolContext const&)::'lambda'(llvm::SmallVectorImpl<char const*>&)>(long, llvm::SmallVectorImpl<char const*>&) /home/leebc/src/oss/llvm-project/llvm/include/llvm/ADT/STLFunctionalExtras.h:47:3 #37 0x00000000052b4f11 llvm::function_ref<int (llvm::SmallVectorImpl<char const*>&)>::operator()(llvm::SmallVectorImpl<char const*>&) const /home/leebc/src/oss/llvm-project/llvm/include/llvm/ADT/STLFunctionalExtras.h:69:3 #38 0x00000000052b3c80 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'()::operator()() const /home/leebc/src/oss/llvm-project/clang/lib/Driver/Job.cpp:440:32 #39 0x00000000052b4097 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) /home/leebc/src/oss/llvm-project/llvm/include/llvm/ADT/STLFunctionalExtras.h:46:40 #40 0x00000000033aad48 llvm::function_ref<void ()>::operator()() const /home/leebc/src/oss/llvm-project/llvm/include/llvm/ADT/STLFunctionalExtras.h:68:62 #41 0x0000000004513f03 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) /home/leebc/src/oss/llvm-project/llvm/lib/Support/CrashRecoveryContext.cpp:427:10 #42 0x00000000052b3e6c clang::driver::CC1Command::Execute(llvm::ArrayRef<std::optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const /home/leebc/src/oss/llvm-project/clang/lib/Driver/Job.cpp:440:7 #43 0x000000000525825b clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const /home/leebc/src/oss/llvm-project/clang/lib/Driver/Compilation.cpp:199:22 #44 0x0000000005258587 clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&, bool) const /home/leebc/src/oss/llvm-project/clang/lib/Driver/Compilation.cpp:253:62 #45 0x000000000526a698 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) /home/leebc/src/oss/llvm-project/clang/lib/Driver/Driver.cpp:1884:28 #46 0x0000000000d5c0f4 clang_main(int, char**, llvm::ToolContext const&) /home/leebc/src/oss/llvm-project/clang/tools/driver/driver.cpp:542:39 #47 0x0000000000d90d5c main /home/leebc/src/oss/llvm-project/build-clang/tools/clang/tools/driver/clang-driver.cpp:15:58 #48 0x00007f5d54d68b8a __libc_start_call_main (/lib64/libc.so.6+0x27b8a) #49 0x00007f5d54d68c4b __libc_start_main@GLIBC_2.2.5 (/lib64/libc.so.6+0x27c4b) #50 0x0000000000d59325 _start (/home/leebc/src/oss/llvm-project/build-clang/bin/clang+++0xd59325) clang++: error: clang frontend command failed with exit code 139 (use -v to see invocation) clang version 18.0.0 (https://github.com/llvm/llvm-project.git eef35c287ee093b3521c6c2b682d8da538ad28be) Target: x86_64-unknown-linux-gnu Thread model: posix InstalledDir: /home/leebc/src/oss/llvm-project/build-clang/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/ASTContext-0f4f78.cpp clang++: note: diagnostic msg: /tmp/ASTContext-0f4f78.sh clang++: note: diagnostic msg: ******************** Link to the diagnostic files: AstContext-0f4f78.zip
If I remove -Wdocumentation flag, it works well.
Metadata
Metadata
Assignees
Labels
clang:frontendLanguage frontend issues, e.g. anything involving "Sema"Language frontend issues, e.g. anything involving "Sema"crashPrefer [crash-on-valid] or [crash-on-invalid]Prefer [crash-on-valid] or [crash-on-invalid]