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

Convert crash on binop to controlled error #461

Closed
wants to merge 2 commits into from

Conversation

septract
Copy link
Collaborator

@septract septract commented Aug 4, 2024

Partially addresses #233

@septract
Copy link
Collaborator Author

septract commented Aug 4, 2024

@cp526 I guessed at an error message, but perhaps you can propose something better?

| _ ->
fail (fun _ ->
{ loc;
msg = Generic !^"M_PEbounded_binop: unsupported on non-integer types"
Copy link
Collaborator

Choose a reason for hiding this comment

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

This should probably mention that this is unsupported on anything other than unsigned integers.

@cp526
Copy link
Collaborator

cp526 commented Aug 5, 2024

... Although I think these might really be proper assertion failures.

@septract
Copy link
Collaborator Author

septract commented Aug 5, 2024

What does it mean for this to be a proper assertion failure? I would assume these should only occur in anomalous states, ie states that should be prevented by some other CN code

@cp526
Copy link
Collaborator

cp526 commented Aug 5, 2024

I suspect we're in that kind of situation here: something in CN+Cerberus's earlier logic should prevent an application of M_PEbounded_binop (M_Bound_Wrap, ...) when the C-type is a signed integer (wrapping behaviour typically only happens for unsigned types).

Similarly, the M_PEbounded_binop below should only happen on integer types.

@septract
Copy link
Collaborator Author

septract commented Aug 5, 2024

Huh, okay - so is the conclusion that the crash in #233 is actually a bug in CN, rather than an unsupported feature? That seems more difficult to resolve, & probably needs you to take a deeper look @cp526

@cp526
Copy link
Collaborator

cp526 commented Aug 5, 2024

Yes, I think so; I see no reason why CN shouldn't handle the example from #233 .

@septract
Copy link
Collaborator Author

septract commented Aug 5, 2024

Okay, I'm closing this PR - looks like someone should look at the root cause of #233 (I'll take a look but I suspect it's too deep in the stack for my level of understanding)

@septract septract closed this Aug 5, 2024
@septract septract deleted the mdd/binop-crash branch August 19, 2024 21:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants