Skip to content

Add some way to segfault #24

@chambart

Description

@chambart

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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions