The following code causes a segmentation fault when compiled in bytecode (not in native):
let rec f =
let [| f0 |] = [| 0 |] in
function
| 0 -> f0
| n -> f (n - 1)
let _ = f 1
Even weirder, the issue still stands when replacing the code by this:
let rec f =
let 0 = 0 in
function
| 0 -> 0
| n -> f (n - 1)
let _ = f 1
It seems the conjunction of a non-exhaustive pattern-matching and a let rec doesn't work very well. To be fair, the manual only describes the case let rec f = let x = _ in _, and not the case where x is replaced by a pattern, but it seems that replacing it by any exhaustive non-constructor pattern (tuples, records, polymorphic variant, lazy) causes no such issue.
The following code causes a segmentation fault when compiled in bytecode (not in native):
Even weirder, the issue still stands when replacing the code by this:
It seems the conjunction of a non-exhaustive pattern-matching and a
let recdoesn't work very well. To be fair, the manual only describes the caselet rec f = let x = _ in _, and not the case wherexis replaced by a pattern, but it seems that replacing it by any exhaustive non-constructor pattern (tuples, records, polymorphic variant, lazy) causes no such issue.