-
Notifications
You must be signed in to change notification settings - Fork 10.6k
Description
Describe the bug
I found a specific project setup where a simple call to a mostly empty async function never returns (note that this doesn't happen in simpler setups without some dependencies, see the linked repo for a reproducible issue).
Also, with some additional dependencies, even if not imported but just listed as dependencies in Package.swift, it can change the behavior and cause a crash with a segfault for instance.
Here, swift run -c release -Xswiftc -static-executable never goes beyond printing "During foo()"
func foo() async {
print("During foo()")
}
@main
struct App {
static func main() async throws {
print("Before calling foo()")
let bar = await foo()
print("After calling foo()")
}
}Steps To Reproduce
Steps to reproduce the behavior:
- Clone
https://github.com/PopFlamingo/fluffy-disco.git - Run it with
swift run -c release -Xswiftc -static-executable(I can reproduce from theswiftlang/swift:nightly-5.7-focalDocker image which currently has the following toolchainSwift version 5.7-dev (LLVM c94b55955148b74, Swift 13b3ac91a618617))
Note that the linked repo has a .devcontainer included for easier reproduction in VSCode and others.
Expected behavior
Program should print and exit but does not and stops in the foo() call.
Environment (please fill out the following information)
swift --version
Swift version 5.7-dev (LLVM c94b55955148b74, Swift 13b3ac91a618617)
Target: x86_64-unknown-linux-gnu
cc @ktoso