Skip to content

SCT: fix use of liveness information in for loops #1219

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
Jun 26, 2025
Merged

Conversation

vbgl
Copy link
Member

@vbgl vbgl commented Jun 25, 2025

Fixes #1218.

@vbgl vbgl added this to the 2025.06.1 milestone Jun 25, 2025
eponier
eponier previously approved these changes Jun 26, 2025
Copy link
Contributor

@eponier eponier left a comment

Choose a reason for hiding this comment

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

I don't understand the fix, but I trust you.

@vbgl
Copy link
Member Author

vbgl commented Jun 26, 2025

You should not: I have also introduced the bug…

@eponier
Copy link
Contributor

eponier commented Jun 26, 2025

Then can you explain the problem and the fix, please?

@vbgl
Copy link
Member Author

vbgl commented Jun 26, 2025

The problem is explained en the bug report: when checking a for loop and looking for a fixed point, the environments are restricted to a set of “live” variables. The set currently being used is the set of variables that are live before the for loop, which is wrong: in the example, variable a dies after evaluating the guard hence is no longer bound in the environment after analyzing the body.

The fix consists in using the correct liveness data: the set of variables live at the beginning of the loop body, i.e., after the condition.

This bug also suggests that it might be useful to store this live set in the Cfor instruction, as is done with while loops.

Copy link
Contributor

@eponier eponier left a comment

Choose a reason for hiding this comment

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

Thanks for the explanation!

@eponier eponier merged commit 7cd9c1a into main Jun 26, 2025
1 check passed
@eponier eponier deleted the sct-for-live branch June 26, 2025 13:18
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.

SCT & for loop: failed assertion
2 participants