Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compiler crash on internal Foundation import #70644

Closed
mr-swifter opened this issue Dec 28, 2023 · 2 comments
Closed

Compiler crash on internal Foundation import #70644

mr-swifter opened this issue Dec 28, 2023 · 2 comments
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. crash Bug: A crash, i.e., an abnormal termination of software indexing Area → source tooling: AST indexing triage needed This issue needs more specific labels

Comments

@mr-swifter
Copy link

Description

During development I accidentally added internal import of Foundation library. The product/target itself compiles normally, but compilation of target which depends on that target fails with a compiler crash.

Reproduction

internal import Foundation

and compile any dependant target. if remove internal keyword the program compiles normally.

Stack dump

Stack dump:
0.	Program arguments: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift-frontend -frontend -c -primary-file /Users/ordo/Dev/PRs/package-frostflake/Sources/FrostflakeUtility/FrostflakeUtility.swift -emit-dependencies-path /Users/ordo/Dev/PRs/package-frostflake/.build/arm64-apple-macosx/debug/FrostflakeUtility.build/FrostflakeUtility.d -emit-reference-dependencies-path /Users/ordo/Dev/PRs/package-frostflake/.build/arm64-apple-macosx/debug/FrostflakeUtility.build/FrostflakeUtility.swiftdeps -target arm64-apple-macosx13.0 -Xllvm -aarch64-use-tbi -enable-objc-interop -stack-check -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk -I /Users/ordo/Dev/PRs/package-frostflake/.build/arm64-apple-macosx/debug -I /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/usr/lib -F /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/Library/Frameworks -color-diagnostics -enable-testing -g -module-cache-path /Users/ordo/Dev/PRs/package-frostflake/.build/arm64-apple-macosx/debug/ModuleCache -swift-version 5 -Onone -D SWIFT_PACKAGE -D DEBUG -new-driver-path /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift-driver -entry-point-function-name FrostflakeUtility_main -empty-abi-descriptor -resource-dir /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift -enable-anonymous-context-mangled-names -Xcc -fmodule-map-file=/Users/ordo/Dev/PRs/package-frostflake/.build/checkouts/swift-system/Sources/CSystem/include/module.modulemap -Xcc -I -Xcc /Users/ordo/Dev/PRs/package-frostflake/.build/checkouts/swift-system/Sources/CSystem/include -Xcc -isysroot -Xcc /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk -Xcc -F -Xcc /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/Library/Frameworks -Xcc -fPIC -module-name FrostflakeUtility -package-name package_frostflake -disable-clang-spi -target-sdk-version 14.0 -target-sdk-name macosx14.0 -external-plugin-path /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/usr/lib/swift/host/plugins#/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/usr/bin/swift-plugin-server -external-plugin-path /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/usr/local/lib/swift/host/plugins#/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/usr/bin/swift-plugin-server -external-plugin-path /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/usr/lib/swift/host/plugins#/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/usr/bin/swift-plugin-server -external-plugin-path /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/usr/local/lib/swift/host/plugins#/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/usr/bin/swift-plugin-server -plugin-path /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/host/plugins -plugin-path /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/local/lib/swift/host/plugins -parse-as-library -o /Users/ordo/Dev/PRs/package-frostflake/.build/arm64-apple-macosx/debug/FrostflakeUtility.build/FrostflakeUtility.swift.o -index-store-path /Users/ordo/Dev/PRs/package-frostflake/.build/arm64-apple-macosx/debug/index/store -index-system-modules
1.	Apple Swift version 5.9 (swiftlang-5.9.0.128.108 clang-1500.0.40.1)
2.	Compiling with the current language version
Stack dump without symbol names (ensure you have llvm-symbolizer in your PATH or set the environment var `LLVM_SYMBOLIZER_PATH` to point to it):
0  swift-frontend           0x0000000106e2b14c llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 56
1  swift-frontend           0x00000001099a9f2c llvm::sys::RunSignalHandlers() + 112
2  swift-frontend           0x00000001056eb10c SignalHandler(int) + 352
3  libsystem_platform.dylib 0x000000018df59a24 _sigtramp + 56
4  swift-frontend           0x000000010830c724 (anonymous namespace)::IndexSwiftASTWalker::visitImports((anonymous namespace)::SourceFileOrModule, llvm::SmallPtrSetImpl<swift::ModuleDecl*>&) + 764
5  swift-frontend           0x000000010830c724 (anonymous namespace)::IndexSwiftASTWalker::visitImports((anonymous namespace)::SourceFileOrModule, llvm::SmallPtrSetImpl<swift::ModuleDecl*>&) + 764
6  swift-frontend           0x000000010830c9ec (anonymous namespace)::IndexSwiftASTWalker::visitImports((anonymous namespace)::SourceFileOrModule, llvm::SmallPtrSetImpl<swift::ModuleDecl*>&) + 1476
7  swift-frontend           0x0000000108074540 (anonymous namespace)::IndexSwiftASTWalker::visitModule(swift::ModuleDecl&) + 160
8  swift-frontend           0x000000010806d058 swift::index::indexSourceFile(swift::SourceFile*, swift::index::IndexDataConsumer&) + 392
9  swift-frontend           0x000000010833b918 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&) (.llvm.15433868400298800835) + 1636
10 swift-frontend           0x0000000108337ce8 swift::index::indexAndRecord(swift::SourceFile*, llvm::StringRef, llvm::StringRef, bool, bool, bool, bool, bool, llvm::StringRef, swift::DependencyTracker const&, swift::PathRemapper const&) + 440
11 swift-frontend           0x0000000109953838 emitIndexDataForSourceFile(swift::SourceFile*, swift::CompilerInstance const&) + 520
12 swift-frontend           0x0000000109958858 performEndOfPipelineActions(swift::CompilerInstance&) + 7888
13 swift-frontend           0x000000010995cc30 generateCode(swift::CompilerInstance&, llvm::StringRef, llvm::Module*, llvm::GlobalVariable*) + 184
14 swift-frontend           0x000000010923f618 performCompileStepsPostSILGen(swift::CompilerInstance&, std::__1::unique_ptr<swift::SILModule, std::__1::default_delete<swift::SILModule>>, llvm::PointerUnion<swift::ModuleDecl*, swift::SourceFile*>, swift::PrimarySpecificPaths const&, int&, swift::FrontendObserver*) + 1708
15 swift-frontend           0x000000010996191c performCompile(swift::CompilerInstance&, int&, swift::FrontendObserver*) + 1748
16 swift-frontend           0x0000000109965474 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 4568
17 swift-frontend           0x00000001092ab4e0 swift::mainEntry(int, char const**) + 4116
18 dyld                     0x000000018dbb1058 start + 2224

Expected behavior

Compilation error, but not crash.

Environment

swift-driver version: 1.87.1 Apple Swift version 5.9 (swiftlang-5.9.0.128.108 clang-1500.0.40.1)
Target: arm64-apple-macosx14.0

Additional information

No response

@mr-swifter mr-swifter added bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. crash Bug: A crash, i.e., an abnormal termination of software triage needed This issue needs more specific labels labels Dec 28, 2023
@tshortli tshortli added the indexing Area → source tooling: AST indexing label Jan 11, 2024
@mr-swifter
Copy link
Author

Actually it also happens in my project on regulate import of dependency target, not only internal import.

@mr-swifter mr-swifter changed the title Compiler crash on internal import of Foundation Compiler crash on using import with AccessLevelOnImport feature Jan 15, 2024
@mr-swifter mr-swifter changed the title Compiler crash on using import with AccessLevelOnImport feature Compiler crash on internal Foundation import Jan 15, 2024
@mr-swifter
Copy link
Author

Closing as duplicate of better specified issue: #70920

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. crash Bug: A crash, i.e., an abnormal termination of software indexing Area → source tooling: AST indexing triage needed This issue needs more specific labels
Projects
None yet
Development

No branches or pull requests

2 participants