You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
analysis segmentation fault for references after #7887 #8475
Segmentation fault in editor analysis references after for...of typedtree change #7887
The editor analysis binary can segfault when running references against an existing project (using v12) after commit f97609381a56063edf37c6b3bdd352f77fe44189. In 1ec0a25be752e97e22fce0d827b08c5e8c69c8fc (Move rescript.json reading out of bsc into rewatch - #8365) references works.
That commit adds new typedtree constructors for for...of / for await...of:
Texp_for_of
Texp_for_await_of
but the CMT magic number was not changed. Because .cmt files are marshalled OCaml values, changing the typedtree shape without changing the magic number can make the analysis binary read incompatible/stale .cmt files as if they were valid. This can produce invalid runtime values and segfault before OCaml exception handling can catch it.
It's a break because the compiler repo is on v13 and rescript-lang.org uses v12.2.0, but it's an important point for migration. It is necessary to remove all lib folders with cmt files.
Codex suggestions
Suspected cause
f97609381 changes the marshalled typedtree representation by adding new constructors, but Config.cmt_magic_number remains unchanged.
Since editor analysis reads .cmt files through Cmt_format.read_cmt, stale or ABI-incompatible .cmt files can pass the magic-number check and then crash during unmarshalling or typedtree traversal.
Possible fix
Bump the CMT magic number when changing typedtree constructors. Since this commit also changes parsetree constructors, AST magic may need to be reviewed as well.
Activity
aspeddro commentedon Jun 17, 2026
Using #8477