Skip to content

Fix up RMW operand types in TypeRefining#8525

Open
tlively wants to merge 1 commit intomainfrom
type-refining-rmw
Open

Fix up RMW operand types in TypeRefining#8525
tlively wants to merge 1 commit intomainfrom
type-refining-rmw

Conversation

@tlively
Copy link
Member

@tlively tlively commented Mar 26, 2026

When TypeRefining manages to refine a field type using GUFA as its analysis, it's possible that the written operand is not actually a subtype of the refined field type. This can happen when GUFA determines that the writing operation is never actually executed. To maintain valid code in this case, TypeRefining inserts a cast on the operand to fix up its type. We were missing this fixup logic for struct RMW operations. Fix the bug and add tests, including for array operations. TypeRefining does not optimize arrays, but if it does in the future, these tests will prevent a similar bug from occurring.

When TypeRefining manages to refine a field type using GUFA as its analysis, it's possible that the written operand is not actually a subtype of the refined field type. This can happen when GUFA determines that the writing operation is never actually executed. To maintain valid code in this case, TypeRefining inserts a cast on the operand to fix up its type. We were missing this fixup logic for struct RMW operations. Fix the bug and add tests, including for array operations. TypeRefining does not optimize arrays, but if it does in the future, these tests will prevent a similar bug from occurring.
@tlively tlively requested a review from a team as a code owner March 26, 2026 01:12
@tlively tlively requested review from kripken and removed request for a team March 26, 2026 01:12
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.

1 participant