Open
Description
Description
Tests fail in release mode unless -no-whole-module-optimization
is passed.
Reproduction
Sorry, it's not a small repro, but then a WMO bug would tend not to be, right?
- Check out the
possible-swift-wmo-bug
tag of https://github.com/hylo-lang/hylo git submodule update --init
- Satisfy the prerequisites for building
swift test --filter Execution
to see a test passswift test -Xswiftc -enable-testing -c release --filter Execution
to see the failure (afatalError
call).
Apply this patch:
diff --git a/Package.swift b/Package.swift
index 36a041409..69f77b569 100644
--- a/Package.swift
+++ b/Package.swift
@@ -10,7 +10,7 @@ import PackageDescription
/// Settings to be passed to swiftc for all targets.
let allTargetsSwiftSettings: [SwiftSetting] = [
- .unsafeFlags(["-warnings-as-errors", "-enable-testing"])
+ .unsafeFlags(["-warnings-as-errors", "-enable-testing", "-no-whole-module-optimization"])
]
/// Dependencies for documentation extraction.
Repeat the command to see it not fail.
Alternatively, apply this patch
1 file changed, 1 insertion(+), 2 deletions(-)
StandardLibrary/StandardLibrary.swift | 3 +--
modified StandardLibrary/StandardLibrary.swift
@@ -24,7 +24,6 @@ extension Utils.Host {
/// platform.
public static let hostedLibraryAST = Result {
try AST(libraryRoot: hostedLibrarySourceRoot, for: CompilerConfiguration([]))
- .roundTripSerialized()
}
/// An AST representing the freestanding core of standard library, conditionally compiled for
@@ -32,7 +31,7 @@ extension Utils.Host {
public static let freestandingLibraryAST = Result {
try AST(
libraryRoot: freestandingLibrarySourceRoot, for: CompilerConfiguration(["freestanding"])
- ).roundTripSerialized()
+ )
}
}
and repeat the command to see it not fail.
Expected behavior
Same behavior in debug and release builds; no observable change from turning on/off WMO; round-trip serialization makes no difference, or at least has the same effect in debug and release builds.
Environment
swift-driver version: 1.87.3 Apple Swift version 5.9.2 (swiftlang-5.9.2.2.56 clang-1500.1.0.2.5)
Target: arm64-apple-macosx14.0
Additional information
No response