Skip to content
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

Checksafety: soundly handle ArrayInit #343

Merged
merged 1 commit into from
Feb 20, 2023
Merged

Conversation

vbgl
Copy link
Member

@vbgl vbgl commented Feb 3, 2023

Currently, the safety checker crashes when it encounters an explicit ArrayInit “instruction”.

Note that some of the added code is not tested as I don’t know how to exercise it…

@vbgl
Copy link
Member Author

vbgl commented Feb 3, 2023

@vbgl
Copy link
Member Author

vbgl commented Feb 3, 2023

Hmm, I guessed wrong the PR number…

@vbgl vbgl force-pushed the checksafety-array-init branch from 0b76d20 to aac0c93 Compare February 13, 2023 13:42
Copy link
Contributor

@bgregoir bgregoir left a comment

Choose a reason for hiding this comment

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

Hi Vincent,
I am not able to understand this path. It is not du to the patch itself, but to my general understanding of this code.
If I understand well, for array_init we should forget what we known about the array (or the cell of the array). In a sense we should recover the state that we have for local variables just after entering in a function. Are we sure that your patch ensure that ?

@vbgl vbgl force-pushed the checksafety-array-init branch from aac0c93 to bc2ffc3 Compare February 15, 2023 13:55
@vbgl vbgl force-pushed the checksafety-array-init branch from bc2ffc3 to d2e32a2 Compare February 15, 2023 13:56
@vbgl
Copy link
Member Author

vbgl commented Feb 15, 2023

Well spotted. I’ve thus added a negative test case.

CI: https://gitlab.com/jasmin-lang/jasmin/-/pipelines/778487126

@eponier
Copy link
Contributor

eponier commented Feb 15, 2023

If you want to exercise the code a bit more, you can use s = a[(int)r:1];.

@eponier
Copy link
Contributor

eponier commented Feb 15, 2023

Well, this exercises the second case of assign_slice, but this is not the main point of this PR. Exercising the other interesting cases seems impossible to me.

@vbgl
Copy link
Member Author

vbgl commented Feb 20, 2023

Then I’d recommend to merge this as-is.

@eponier eponier merged commit 19713de into main Feb 20, 2023
@eponier eponier deleted the checksafety-array-init branch February 20, 2023 10:05
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.

3 participants