Skip to content

compiler destructive update: Fix crash caused by patch order - #9909

Merged
lucioleKi merged 1 commit into
erlang:maintfrom
lucioleKi:isabell/compiler/fix/GH-9903/OTP-19660
Jun 9, 2025
Merged

lucioleKi merged 1 commit into
erlang:maintfrom
lucioleKi:isabell/compiler/fix/GH-9903/OTP-19660

Conversation

@lucioleKi

Copy link
Copy Markdown
Contributor

Fix #9903

@lucioleKi
lucioleKi requested a review from bjorng June 5, 2025 12:12
@lucioleKi lucioleKi self-assigned this Jun 5, 2025
@lucioleKi lucioleKi added team:VM Assigned to OTP team VM testing currently being tested, tag is used by OTP internal CI labels Jun 5, 2025
@github-actions

github-actions Bot commented Jun 5, 2025 •

Copy link
Copy Markdown
Contributor

CT Test Results

    2 files    333 suites   8m 39s ⏱️
  847 tests   843 ✅ 4 💤 0 ❌
5 602 runs  5 598 ✅ 4 💤 0 ❌

Results for commit d470827.

♻️ This comment has been updated with latest results.

To speed up review, make sure that you have read Contributing to Erlang/OTP and that all checks pass.

See the TESTING and DEVELOPMENT HowTo guides for details about how to run test locally.

Artifacts

// Erlang/OTP Github Action Bot

{tuple_elements,[{IA,EA}|Es]};
merge_patches({tuple_elements,Es}, {tuple_element,IA,EA,_}) ->
{tuple_elements,[{IA,EA}|Es]};
merge_patches(Patch, {self,heap_tuple}) ->

@frej frej Jun 5, 2025 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would have incorporated @TrevorSA123's cause analysis into the commit message, and updated the comment for this clause and the next. The important part being that we want the merge to be commutative with respect to {self,heap_tuple} and that as soon as we find something that's more specific, the more specific patch subsumes the {self,heap_tuple}.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with the updated patch, comment resolved.

Fix erlang#9903.
In `beam_ssa_destructive_update:patch_is/5`, OTP 28 uses
`lists:splitwith/2`, which may deliver a patch list where a more
specific patch is placed before a less specific patch. Therefore,
in the later `merge_patches/2`, the merging logic needs to be
commutative and takes care of all possible orders of patches.
@lucioleKi
lucioleKi force-pushed the isabell/compiler/fix/GH-9903/OTP-19660 branch from b477503 to d470827 Compare June 9, 2025 08:51
@lucioleKi
lucioleKi merged commit 4bf7ec9 into erlang:maint Jun 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

team:VM Assigned to OTP team VM testing currently being tested, tag is used by OTP internal CI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants