-
Notifications
You must be signed in to change notification settings - Fork 10.4k
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
Possible -whole-module-optimization
bug
#70979
Comments
And of course, you can't do a clean build with the |
Applying |
Hi! |
Actually I was mistaken. fumoboy007/msgpack-swift#4 does seem to be caused by some change in Swift 5.9. I moved the relevant code to its own Swift package: OptimizationBugRepro.zip. The smaller package exhibits unexpected behavior with Swift 5.9.2 (release configuration, WMO enabled) but succeeds with Swift 5.8.1. Using the prebuilt Swift development snapshots, I narrowed down the culprit to one of 85 commits. I was unable to narrow it down further because I couldn’t solve some issues with manually building the Swift compiler from source. Sorry for hijacking this thread… hopefully my small reproduction test case (396 lines) can help a Swift compiler engineer easily find the culprit. Here is var messageWriter = MessageWriter()
try EncodableMessagePackValue.nil.encode(to: &messageWriter)
// Should print "[192]".
print(Array(messageWriter.message)) The relevant stack looks like this:
As you can see, the logic is quite straightforward. The rest of the code in the package unfortunately needs to be there; otherwise the issue disappears! |
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?
possible-swift-wmo-bug
tag of https://github.com/hylo-lang/hylogit submodule update --init
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:
Repeat the command to see it not fail.
Alternatively, apply this patch
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
The text was updated successfully, but these errors were encountered: