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 using isolated parameter and typed throws - "Illegal convention for non-address types" #73170

Closed
Jnosh opened this issue Apr 21, 2024 · 1 comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. concurrency Feature: umbrella label for concurrency language features crash Bug: A crash, i.e., an abnormal termination of software

Comments

@Jnosh
Copy link
Contributor

Jnosh commented Apr 21, 2024

Description

The following code sample causes a crash with the 2024-04-18 Swift 6.0 development snapshot.

Reproduction

actor Test {
    private func foo<E: Error>(_ body: (isolated Test) throws(E) -> Void) throws(E) -> Void {
        return try body(self)
    }

    func bar() throws {
        try foo { _ in }
    }
}

Stack dump

Illegal convention for non-address types
UNREACHABLE executed at /Users/ec2-user/jenkins/workspace/oss-swift-6.0-package-macos/swift/lib/SIL/IR/OperandOwnership.cpp:505!
Please submit a bug report (https://swift.org/contributing/#reporting-bugs) and include the crash backtrace.
Stack dump:
0.	Program arguments: /Users/<username>/Library/Developer/Toolchains/swift-6.0-DEVELOPMENT-SNAPSHOT-2024-04-18-a.xctoolchain/usr/bin/swift-frontend -frontend -c -primary-file main.swift -target arm64-apple-macosx14.0 -Xllvm -aarch64-use-tbi -enable-objc-interop -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk -color-diagnostics -empty-abi-descriptor -resource-dir /Users/<username>/Library/Developer/Toolchains/swift-6.0-DEVELOPMENT-SNAPSHOT-2024-04-18-a.xctoolchain/usr/lib/swift -module-name main -target-sdk-version 14.5 -target-sdk-name macosx14.5 -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 /Users/<username>/Library/Developer/Toolchains/swift-6.0-DEVELOPMENT-SNAPSHOT-2024-04-18-a.xctoolchain/usr/lib/swift/host/plugins -plugin-path /Users/<username>/Library/Developer/Toolchains/swift-6.0-DEVELOPMENT-SNAPSHOT-2024-04-18-a.xctoolchain/usr/local/lib/swift/host/plugins -o /var/folders/mk/5k70fbgj28g370g9tzg97n_80000gn/T/TemporaryDirectory.4uuw2e/main-1.o
1.	Apple Swift version 6.0-dev (LLVM 2c365f15bfc9eae, Swift 4e30159986a0271)
2.	Compiling with effective version 5.10
3.	While verifying SIL function "@$s4main4TestC3baryyKF".
 for 'bar()' (at main.swift:6:5)
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           0x0000000105d06540 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 56
1  swift-frontend           0x0000000105d04d0c llvm::sys::RunSignalHandlers() + 112
2  swift-frontend           0x0000000105d06b88 SignalHandler(int) + 304
3  libsystem_platform.dylib 0x0000000194407584 _sigtramp + 56
4  libsystem_pthread.dylib  0x00000001943d6c20 pthread_kill + 288
5  libsystem_c.dylib        0x00000001942e3a20 abort + 180
6  swift-frontend           0x0000000105c85dec llvm::install_out_of_memory_new_handler() + 0
7  swift-frontend           0x00000001016b3490 (anonymous namespace)::OperandOwnershipClassifier::visitFullApply(swift::FullApplySite) + 520
8  swift-frontend           0x00000001016aec38 swift::Operand::getOperandOwnership(swift::SILModuleConventions*) const + 272
9  swift-frontend           0x00000001017f9768 swift::SILValueOwnershipChecker::gatherNonGuaranteedUsers(llvm::SmallVectorImpl<swift::Operand*>&, llvm::SmallVectorImpl<swift::Operand*>&) + 152
10 swift-frontend           0x00000001017f9a40 swift::SILValueOwnershipChecker::gatherUsers(llvm::SmallVectorImpl<swift::Operand*>&, llvm::SmallVectorImpl<swift::Operand*>&) + 120
11 swift-frontend           0x00000001017f9420 swift::SILValueOwnershipChecker::checkUses() + 156
12 swift-frontend           0x00000001017f91c4 swift::SILValueOwnershipChecker::check() + 216
13 swift-frontend           0x00000001017faf18 verifySILValueHelper(swift::SILFunction const*, swift::SILValue, swift::LinearLifetimeChecker::ErrorBuilder&, swift::DeadEndBlocks*, swift::GuaranteedPhiVerifier&) + 152
14 swift-frontend           0x00000001017fadf0 swift::SILValue::verifyOwnership(swift::DeadEndBlocks*) const + 216
15 swift-frontend           0x000000010181b6fc (anonymous namespace)::SILVerifier::checkValueBaseOwnership(swift::ValueBase*) + 172
16 swift-frontend           0x000000010181e55c (anonymous namespace)::SILVerifier::visitSILInstruction(swift::SILInstruction*) + 6076
17 swift-frontend           0x000000010180ea58 swift::SILVisitorBase<(anonymous namespace)::SILVerifier, void>::visitSILBasicBlock(swift::SILBasicBlock*) + 41244
18 swift-frontend           0x000000010180483c (anonymous namespace)::SILVerifier::visitSILBasicBlock(swift::SILBasicBlock*) + 28
19 swift-frontend           0x00000001018030ec (anonymous namespace)::SILVerifier::visitSILFunction(swift::SILFunction*) + 10044
20 swift-frontend           0x00000001017fc874 swift::SILFunction::verify(swift::CalleeCache*, bool, bool, bool) const + 204
21 swift-frontend           0x00000001017ffa00 swift::SILModule::verify(swift::CalleeCache*, bool, bool) const + 192
22 swift-frontend           0x00000001017ff8d8 swift::SILModule::verify(bool, bool) const + 140
23 swift-frontend           0x0000000100af1b38 swift::CompilerInstance::performSILProcessing(swift::SILModule*) + 136
24 swift-frontend           0x00000001008b6b1c 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*) + 796
25 swift-frontend           0x00000001008b622c swift::performCompileStepsPostSema(swift::CompilerInstance&, int&, swift::FrontendObserver*) + 612
26 swift-frontend           0x00000001008c7424 withSemanticAnalysis(swift::CompilerInstance&, swift::FrontendObserver*, llvm::function_ref<bool (swift::CompilerInstance&)>, bool) + 160
27 swift-frontend           0x00000001008b884c performCompile(swift::CompilerInstance&, int&, swift::FrontendObserver*) + 708
28 swift-frontend           0x00000001008b77b8 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2380
29 swift-frontend           0x00000001006d20ac swift::mainEntry(int, char const**) + 3096
30 dyld                     0x000000019404e0e0 start + 2360

Expected behavior

The compiler should not crash.

Environment

Apple Swift version 6.0-dev (LLVM 2c365f15bfc9eae, Swift 4e30159)
Target: arm64-apple-macosx14.0

Additional information

No response

@Jnosh Jnosh 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 Apr 21, 2024
@hborla hborla added concurrency Feature: umbrella label for concurrency language features and removed triage needed This issue needs more specific labels labels Jul 14, 2024
@Jnosh
Copy link
Contributor Author

Jnosh commented Aug 7, 2024

No longer crashes with the toolchain included with Xcode 16 beta 5

@Jnosh Jnosh closed this as completed Aug 7, 2024
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. concurrency Feature: umbrella label for concurrency language features crash Bug: A crash, i.e., an abnormal termination of software
Projects
None yet
Development

No branches or pull requests

2 participants