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

Add some way to segfault #24

Closed
chambart opened this issue Jun 10, 2015 · 2 comments
Closed

Add some way to segfault #24

chambart opened this issue Jun 10, 2015 · 2 comments
Assignees

Comments

@chambart
Copy link
Member

Jane street is using a segfault function for debugging.
It is doing Obj.set_field (Obj.repr 0) 0 (Obj.repr string_that_should_be_easy_to_detect)
With flambda, this is detected as a misuse of set_field because the literal 0 is (rightly) not considered to be a valid mutable block. set_field seems to be one of the most common misuse unsafe function and its behavior might change in some undefined cases. This check is done to catch early some of those problems.

The best way is probably to add a "trap" primitive that is lowered to dereferencing 0 in cmm.

see https://github.com/janestreet/core_extended/blob/5dab51f080759f032674e0c793d3fd02dfc95800/src/low_level_debug.ml#L12

@mshinwell
Copy link
Collaborator

This is probably still desirable. We would need to make an upstream pull request. It's not essential (but is desirable) for 4.03.

@mshinwell
Copy link
Collaborator

We're using Sys.opaque_identity to get the literal zero now, so I think we don't need to do this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants