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: better handling of integer shift operators #322

Merged
merged 2 commits into from
Jan 18, 2023
Merged

Conversation

vbgl
Copy link
Member

@vbgl vbgl commented Jan 4, 2023

Fixes #319

(The first commit is unrelated, but it does not deserves a PR on its own.)

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

@vbgl
Copy link
Member Author

vbgl commented Jan 10, 2023

Just rebased to fix the merge conflicts in the CHANGELOG.
CI: https://gitlab.com/jasmin-lang/jasmin/-/pipelines/742884901

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 know the safety check, the changes seem reasonable, but I'd like to understand a bit what you did.

Comment on lines +117 to +120
| E.Olsl (Op_w _) -> AB_Wop (Wshift Unsigned_left)
| E.Olsl Op_int -> AB_Unknown
| E.Oasr (Op_w _) -> AB_Wop (Wshift Signed_right)
| E.Oasr Op_int -> AB_Unknown
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we need to distinguish Op_w and Op_int here? And not for other operations?

Copy link
Member Author

Choose a reason for hiding this comment

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

I don’t know. Could you provide an example in which not doing this distinction is a problem?

Copy link
Contributor

Choose a reason for hiding this comment

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

No, I'm trying to understand what you did.

Copy link
Contributor

Choose a reason for hiding this comment

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

Anyway, this is stricter than before...

Comment on lines +338 to +342
| Papp2 (Olsl Op_int, e1, e2) ->
obind2 zlsl
(aeval_cst_zint abs e1) (aeval_cst_zint abs e2)

| Papp2 (Oasr Op_int, e1, e2) ->
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is there nothing for Olsr? Just not done yet?

Copy link
Member Author

Choose a reason for hiding this comment

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

There is no lsr on int.

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 know the safety checker well, so I cannot say that the changes are right, but they are reasonable.

@vbgl vbgl merged commit 309b64c into main Jan 18, 2023
@vbgl vbgl deleted the safety-shint branch January 18, 2023 08:27
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.

Checksafety crash on int shifts
2 participants