Diagnosing Stack_overflow in OCaml: From Symptom to Fix
An uncaught Stack_overflow on large inputs means a recursive call is not in tail position. Diagnose it with bytecode builds, backtraces, and stack-limit tests, then fix it with accumulators, CPS, or explicit worklists.