Skip to content

5.9: [IRGen] Cast fixed-size opaque globals. #67997

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
Aug 18, 2023

Conversation

nate-chandler
Copy link
Contributor

@nate-chandler nate-chandler commented Aug 18, 2023

Description: Add a missing cast when accessing fixed-size globals of opaque type.
Risk: Very low. The change applies code already in use in one code path (non-fixed size) to another (fixed-size).
Scope: Narrow. The change only affects fixed-size globals of opaque type.
Original PR: #68000
Reviewed By: Arnold Schwaighofer ( @aschwaighofer )
Testing: Added a test.
Resolves: rdar://114013709

@nate-chandler nate-chandler requested a review from a team as a code owner August 18, 2023 00:10
@ktoso
Copy link
Contributor

ktoso commented Aug 18, 2023

Resolves #67891

In swiftlang#66560 , a bug in the lowering of
`global_addr` was fixed.  Part of that fix was to postpone mapping the
type of the global into context until getting the address of the global
and projecting the buffer for the out-of-line value; at that point, the
type is mapped into context and the address is cast.

It introduced an issue for fixed-size globals, however: the type of such
globals was not mapped into context; the result was that the lowered
value set for the corresponding SIL value would have the wrong type.

Fix that by extracting the code which mapped the type into context and
cast the address to the appropriate lowered type into a lambda and call
that lambda both in both the fixed-size (newly) and non-fixed-size (as
before) cases.

rdar://114013709
@nate-chandler
Copy link
Contributor Author

@swift-ci please test

@nate-chandler nate-chandler changed the title [IRGen] Cast fixed-size opaque globals. 5.9: [IRGen] Cast fixed-size opaque globals. Aug 18, 2023
@nate-chandler nate-chandler merged commit 1a48e2d into swiftlang:release/5.9 Aug 18, 2023
@nate-chandler nate-chandler deleted the rdar114013709 branch August 18, 2023 15:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants