swiftlang / swift

The Swift Programming Language
https://swift.org
Apache License 2.0
67k stars 10.32k forks source link

Swift-5.9.2-RELEASE compile crash: swift::DeclAttributes::getUnavailable(swift::ASTContext const&) const + 110 #70628

Open vivi50 opened 6 months ago

vivi50 commented 6 months ago

Description

I compile the swift-5.9.2-RELEASE,and then use this toolchain to compile the project SnapKit,it crash

Reproduction

my env: intel core i5

  1. toolchain compilation steps: mkdir swift-project git clone https://github.com/apple/swift.git swift cd swift utils/update-checkout --clone utils/update-checkout --tag swift-5.9.2-RELEASE

  2. build script ` cd swift-project/swift

CMAKE_OPTIONS="-DCMAKE_INSTALL_PREFIX=release,-DLLVM_CREATE_XCODE_TOOLCHAIN=ON,-DCMAKE_OSX_DEPLOYMENT_TARGET=10.9"

utils/build-script \ --skip-build-benchmarks --skip-watchos --skip-tvos \ --swift-darwin-supported-archs "$(uname -m)" \ --release --no-assertions \ --extra-cmake-options="${CMAKE_OPTIONS}" \ --skip-test-tvos-host --skip-test-watchos-host --skip-test-ios --skip-test-tvos --skip-test-watchos --skip-test-osx \ --skip-test-cmark --skip-test-lldb --skip-test-swift --skip-test-llbuild --skip-test-swiftpm \ --skip-test-xctest --skip-test-foundation --skip-test-libdispatch --skip-test-playgroundsupport --skip-test-libicu \ -c \ && \ cd swift-project/build/Ninja-Release/swift-macosx-x86_64 && \ time ninja -j${JOBS} install the toolchain path is swift-project/build/Ninja-Release/swift-macosx-x86_64/release/ `

  1. using toolchain compile project SnapKit, then compile crash, the log is as follows 9d8e8761b9dd2b0988aca23162fb2ba4

Stack dump

...

Expected behavior

it compile success using Xcode15.0

Environment

swift-5.9.2-RELEASE

Additional information

No response

vivi50 commented 6 months ago

append stack dump

` Crashed Thread: 0 Dispatch queue: com.apple.main-thread

Exception Type: EXC_BAD_ACCESS (SIGSEGV) Exception Codes: KERN_INVALID_ADDRESS at 0x0000000124f47c4a Exception Codes: 0x0000000000000001, 0x0000000124f47c4a

Termination Reason: Namespace SIGNAL, Code 11 Segmentation fault: 11 Terminating Process: exc handler [2124]

VM Region Info: 0x124f47c4a is not in any region. Bytes after previous region: 327900235 Bytes before following region: 105548201296822 REGION TYPE START - END [ VSIZE] PRT/MAX SHRMOD REGION DETAIL mapped file 11168d000-111692000 [ 20K] r--/r-- SM=COW ...t_id=2452f705 ---> GAP OF 0x5ffeee96e000 BYTES MALLOC_NANO 600000000000-600008000000 [128.0M] rw-/rwx SM=PRV

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread 0 ??? 0x124f47c4a ??? 1 swift-frontend 0x105c69bbe swift::DeclAttributes::getUnavailable(swift::ASTContext const&) const + 110 2 swift-frontend 0x105c70aa1 swift::AvailableAttr::isUnavailable(swift::Decl const) + 65 3 swift-frontend 0x104a1cd18 (anonymous namespace)::IndexSwiftASTWalker::walkToDeclPre(swift::Decl, swift::CharSourceRange) + 40 4 swift-frontend 0x105405c58 (anonymous namespace)::SemaAnnotator::walkToDeclPre(swift::Decl) + 2312 5 swift-frontend 0x105c5e7c2 (anonymous namespace)::Traversal::doIt(swift::Decl) + 226 6 swift-frontend 0x105c5e6cb swift::Decl::walk(swift::ASTWalker&) + 27 7 swift-frontend 0x105de9b0f swift::FileUnit::walk(swift::ASTWalker&) + 303 8 swift-frontend 0x105de2740 swift::ModuleDecl::walk(swift::ASTWalker&) + 96 9 swift-frontend 0x105403c44 swift::SourceEntityWalker::walk(swift::ModuleDecl&) + 244 10 swift-frontend 0x104a1cb13 (anonymous namespace)::IndexSwiftASTWalker::visitModule(swift::ModuleDecl&) + 371 11 swift-frontend 0x104a1ccce swift::index::indexModule(swift::ModuleDecl, swift::index::IndexDataConsumer&) + 414 12 swift-frontend 0x104a266aa addModuleDependencies(llvm::ArrayRef, llvm::StringRef, bool, bool, bool, bool, llvm::StringRef, clang::CompilerInstance const&, swift::DiagnosticEngine&, clang::index::IndexUnitWriter&, (anonymous namespace)::StringScratchSpace&, swift::PathRemapper const&, swift::SourceFile) + 5674 13 swift-frontend 0x104a246a9 recordSourceFileUnit(swift::SourceFile, llvm::StringRef, llvm::StringRef, bool, bool, bool, bool, bool, llvm::StringRef, llvm::ArrayRef<clang::FileEntry const>, clang::CompilerInstance const&, swift::PathRemapper const&, swift::DiagnosticEngine&) + 873 14 swift-frontend 0x104a242db swift::index::indexAndRecord(swift::SourceFile, llvm::StringRef, llvm::StringRef, bool, bool, bool, bool, bool, llvm::StringRef, swift::DependencyTracker const&, swift::PathRemapper const&) + 267 15 swift-frontend 0x104952d75 emitIndexDataForSourceFile(swift::SourceFile, swift::CompilerInstance const&) + 853 16 swift-frontend 0x1049513ac performEndOfPipelineActions(swift::CompilerInstance&) + 7164 17 swift-frontend 0x10494d7cb swift::performFrontend(llvm::ArrayRef<char const>, char const, void, swift::FrontendObserver) + 9147 18 swift-frontend 0x1047abe24 swift::mainEntry(int, char const**) + 1332 19 dyld 0x7ff816c9e41f start + 1903 `