Skip to content

[6.1] TypeLowering: assume that C unions can contain a pointer #78232

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
merged 1 commit into from
Dec 18, 2024

Conversation

eeckstein
Copy link
Contributor

  • Explanation: Fixes a miscompile caused by C unions containing a pointer. C unions are imported as opaque types. Therefore we have to assume that a union contains a pointer. This is important for alias analysis to catch escaping pointers via C unions.
  • Risk: Low. It is a simple change which makes alias analysis more conservative for C unions.
  • Testing: Tested by a test case.
  • Issue: rdar://141555290
  • Reviewer: @jckarter
  • Main branch PR: TypeLowering: assume that C unions can contain a pointer #78221

@eeckstein eeckstein requested a review from a team as a code owner December 17, 2024 07:38
@eeckstein
Copy link
Contributor Author

@swift-ci test

@eeckstein eeckstein requested a review from jckarter December 17, 2024 07:39
@eeckstein
Copy link
Contributor Author

@swift-ci test macos windows

@eeckstein
Copy link
Contributor Author

@swift-ci test

1 similar comment
@eeckstein
Copy link
Contributor Author

@swift-ci test

C unions are imported as opaque types. Therefore we have to assume that a union contains a pointer.
This is important for alias analysis to catch escaping pointers via C unions.

Fixes a miscompile.
rdar://141555290
@eeckstein eeckstein force-pushed the pointers-in-c-unions-6.1 branch from 766d2d6 to a19b6b8 Compare December 17, 2024 13:38
@eeckstein
Copy link
Contributor Author

@swift-ci test

@eeckstein
Copy link
Contributor Author

@swift-ci test windows

@eeckstein eeckstein merged commit f3fe377 into release/6.1 Dec 18, 2024
5 checks passed
@eeckstein eeckstein deleted the pointers-in-c-unions-6.1 branch December 18, 2024 05:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants