-
Notifications
You must be signed in to change notification settings - Fork 10.5k
swiftinterface generator confuses @exclusivity(unchecked)
and @_optimize(none)
on Windows
#76279
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
Comments
Works around the issue described in swiftlang/swift#76279.
Works around the issue described in swiftlang/swift#76279. ### Checklist: - [x] Code and documentation should follow the style of the [Style Guide](https://github.com/apple/swift-testing/blob/main/Documentation/StyleGuide.md). - [x] If public symbols are renamed or modified, DocC references should be updated.
We've gotten reports now that this is affecting Android and FreeBSD, and in some cases Linux (rdar://151357567). |
There's a recent build log here: https://ci.swift.org/job/swift-bootstrap-ubuntu-24_04-x86_64/142/console In that log, I notice
I have wondered if perhaps the legacy Swift driver is related to this issue, because we recently saw a similar issue with parsing macro declarations from a .swiftinterface (#81346) and that only reproduced when using the legacy driver. |
Minimal reproducer: > cat test.swift
@exclusivity(unchecked)
@usableFromInline nonisolated(unsafe) var failureBreakpointValue = 0
> cat test2.swift
// Intentionally empty.
> swiftc --version
Apple Swift version 6.1 (swift-6.1-RELEASE)
> swiftc -disallow-use-new-driver -v -emit-module -emit-module-interface-path MyMod.swiftinterface -enable-library-evolution -module-name MyMod test.swift test2.swift
...
MyMod.swiftinterface:10:2: error: '@_optimize(none)' attribute cannot be applied to stored properties
8 | import _SwiftConcurrencyShims
9 | @usableFromInline
10 | @_optimize(none) nonisolated(unsafe) internal var failureBreakpointValue: Swift.Int
| `- error: '@_optimize(none)' attribute cannot be applied to stored properties
11 |
MyMod.swiftinterface:1:1: error: failed to verify module interface of 'MyMod' due to the errors above; the textual interface may be broken by project issues or a compiler bug
1 | // swift-interface-format-version: 1.0
| `- error: failed to verify module interface of 'MyMod' due to the errors above; the textual interface may be broken by project issues or a compiler bug
2 | // swift-compiler-version: Apple Swift version 6.1 (swift-6.1-RELEASE)
3 | // swift-module-flags: -target arm64-apple-darwin24.2.0 -enable-objc-interop -enable-library-evolution -module-name MyMod
|
This is not a textual interfaces bug but rather a bug with |
Since swiftpm now depends on swift-testing to build, this bites the swiftpm and the stage2 bootstrap also. The |
Generating swiftinterfaces from a merge-module job was never properly supported, it had a tendency to generate bad code and confuse attributes at printing like this. When using the legacy C++ driver the only option to emit usable swiftinterfaces is to use whole-module compilation. The new driver incremental mode (emit-module-separately) does support swiftinterface properly so there's no need to force using whole-module when using the new driver. Is it possible to update the configuration to use only wmo if we're restricted to using the legacy driver? I assume this was an issue only in debug builds as release should already use wmo. As a risky alternative, you could disable the swiftinterface verification only in debug builds and expect clients to use only the binary swiftmodule locally. We should never distribute this swiftinterface of course. |
@etcwilde is doing this in #81622
Actually no, not until the above PR, as we discovered! It seems as though WMO has not been enabled in any CMake builds of swift-testing, even those intended for release/distribution. |
WMO doesn't always work with the old driver, as it sometimes tries to pass objects and static archives to the frontend as source files, resulting in broken builds as well. I did try to teach CMake to make release builds use WMO, but that had to be rolled back to avoid these kinds of build failures:
|
Uh oh!
There was an error while loading. Please reload this page.
After merging swiftlang/swift-testing#655, CI started failing with a very curious error:
This makes no sense because
failureBreakpointValue
does not have@_optimize(none)
on it, it has@exclusivity(unchecked)
. This issue appears to only affect Windows builds so far.CI compiler info:
The text was updated successfully, but these errors were encountered: