Skip to content

[6.0] ModuleInterface: Print -target-variant flag in .swiftinterface files #75352

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

Merged

Conversation

tshortli
Copy link
Contributor

@tshortli tshortli commented Jul 18, 2024

  • Explanation: The -target-variant flag was accidentally omitted from the compiler flags printed in .swiftinterface files, causing zippered modules containing inlinable if #available checks and @backDeployed declarations to be miscompiled when compiled from interface.
  • Scope: This miscompile manifests in Swift Testing's use of the withValue() to manage a @TaskLocal. Without the fix, a test compiled for macCatalyst and using Swift Testing could crash unexpectedly when running on an older version of macOS. Any macCatalyst app using any @backDeployed API could run into similar issues, and @backDeployed was adopted heavily in commonly used APIs.
  • Issue/Radar: rdar://130094532
  • Original PR: ModuleInterface: Print -target-variant flag in .swiftinterface files #75349
  • Risk: Medium. I am confident that adding -target-variant to .swiftinterfaces is correct. However, doing so may reveal other issues since we do not have experience with libraries including this flag correctly.
  • Testing: New regression tests were added to the compiler test suite.
  • Reviewer: @mikeash @xymus @artemcm @nkcsgexi

This is necessary to ensure that availability checks contained in inlined
functions are compiled correctly for zippered modules when built from
interface.

Resolves rdar://130094532.
@tshortli tshortli added 🍒 release cherry pick Flag: Release branch cherry picks swift 6.0 labels Jul 18, 2024
@tshortli tshortli requested a review from a team as a code owner July 18, 2024 21:00
@tshortli
Copy link
Contributor Author

@swift-ci please test

@tshortli tshortli requested a review from nkcsgexi July 18, 2024 21:32
@tshortli tshortli marked this pull request as draft July 18, 2024 23:59
@tshortli tshortli marked this pull request as ready for review July 19, 2024 16:32
Copy link
Contributor

@nkcsgexi nkcsgexi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Runtime issues originated from this bug are hard to diagnose and debug, therefore landing this change on release/6.0 seems to me the right thing to do.

@tshortli tshortli merged commit 3a9161c into swiftlang:release/6.0 Jul 19, 2024
5 checks passed
@tshortli tshortli deleted the inlined-zippered-availability-6.0 branch July 19, 2024 21:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🍒 release cherry pick Flag: Release branch cherry picks swift 6.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants