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

Safety-checker: support for SLH primitives #814

Merged
merged 1 commit into from
Jun 3, 2024
Merged

Conversation

vbgl
Copy link
Member

@vbgl vbgl commented May 29, 2024

Fixes #670

@vbgl vbgl added this to the 2024.06.0 milestone May 29, 2024
let msf = Pif (Bty (U U64), b, msf, pcast U64 (Pconst (Z.of_int (-1)))) in
[ Some msf ]
| SLHmove -> let msf = as_seq1 es in [ Some msf ]
| SLHprotect _ | SLHprotect_ptr _ ->
Copy link
Contributor

Choose a reason for hiding this comment

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

This is suspicious, what about protect(x, -1)? I think you assume that the program is well typed for SCT.

Copy link
Member Author

Choose a reason for hiding this comment

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

What’s the semantics of #protect?

Copy link
Contributor

Choose a reason for hiding this comment

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

You are right, I forgot that the semantic of protect is the identity at source level.
Sorry for that.

Copy link
Member Author

Choose a reason for hiding this comment

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

This program is well-typed and has a well-defined semantics (the identity). However, it cannot be compiled.

export
fn p(reg u64 x) -> reg u64 {
reg u64 y msf;
msf = 42;
y = #protect(x, msf);
return y;
}

@bgregoir bgregoir merged commit 83e232e into main Jun 3, 2024
1 check passed
@bgregoir bgregoir deleted the checksafety-slh branch June 3, 2024 06:43
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.

Safety checker & SLH
2 participants