The long-term goal is that stack overflows from OCaml code are properly reported as Stack_overflow
exceptions, and stack overflows from C code are (1) avoided if at all possible in the OCaml run-time system, and (2) reported as SEGV signals otherwise. But catching stack overflows is tricky, both in Unix-like systems and under Windows, so the current implementation in OCaml is a best effort that is occasionally buggy.
So, with native code compilation, never rely on stack overflows being turned into exceptions. Just treat the Stack_overflow
as a debugging aid.