-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[IRGen] Fix witness table miscompilation. #60529
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
Conversation
f30aa68
to
1ef422d
Compare
@swift-ci Please smoke test |
Hmmm. That exploded unexpectedly. I'll keep digging then. |
Is it possible to add a test case? |
1ef422d
to
5380bc8
Compare
Should be, yes. |
@swift-ci Please smoke test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM except that it's missing a test case.
Having looked at this a bit further, I don't think it's feasible to write a test case that will work on macOS (this only affects synthesized conformances, which means the protocol in question needs to be in the Swift standard library, but on macOS that's dynamically linked and always resilient; building a test case there would require a fairly heroic effort), but it's probably possible on Linux. Trying to get a Linux build up so I can test it. |
d829608
to
1992741
Compare
It turns out that it was feasible. Just somewhat tricky to get right (the compiler doesn't give very helpful error messages when bits of the |
@swift-ci Please smoke test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
Failed on Windows and Linux, probably because of the section name. Looking at that now. |
@swift-ci Please smoke test |
If a foreign type conforms to a protocol, and that conformance is not resilient, we were emitting an instantantiation function but it would never be called because we weren't emitting the `GenericWitnessTable` that would have contained a reference to it. This was happening because of a missing `isSynthesizedNonUnique()` call in `isDependentConformance()`. rdar://97290618
isDependentConformance() should always check for synthesized conformances, so do that further up the function. Also add a test. rdar://97290618
Changed the test case to pattern match various parts to make it work on 32-bit. rdar://97290618
d7550e6
to
428789d
Compare
Windows adds a `comdat` flag. rdar://97290618
Linux uses different section names. rdar://97690618
@swift-ci Please smoke test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
If a foreign type conforms to a protocol, and that conformance is not resilient, we were emitting an instantantiation function but it would never be called because we weren't emitting the
GenericWitnessTable
that would have contained a reference to it.This was happening because of a missing
isSynthesizedNonUnique()
call inisDependentConformance()
.rdar://97290618