From e9c9a6a2b23c8fc6a0dd2ee3040b1aebcbd4dd09 Mon Sep 17 00:00:00 2001 From: Jan Midtgaard Date: Mon, 9 Sep 2024 13:46:42 +0200 Subject: [PATCH] Avoid triggering Gc.counters memory unsafety on 5.2 and earlier --- src/gc/stm_tests.ml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/gc/stm_tests.ml b/src/gc/stm_tests.ml index b25caafd..41b743b9 100644 --- a/src/gc/stm_tests.ml +++ b/src/gc/stm_tests.ml @@ -59,9 +59,9 @@ struct let index_gen = Gen.int_bound (array_length-1) in QCheck.make ~print:show_cmd Gen.(frequency + (let gens = [ 1, return Stat; 1, return Quick_stat; - 1, return Counters; (* known problem with Counters on <= 5.2: https://github.com/ocaml/ocaml/pull/13370 *) 1, return Minor_words; 1, return Get; 1, return Minor; @@ -77,7 +77,10 @@ struct 5, map3 (fun src1 src2 tgt -> CatStr (src1,src2,tgt)) index_gen index_gen index_gen; 10, map2 (fun index len -> AllocList (index,len)) index_gen Gen.nat; 10, map (fun index -> RevList index) index_gen; - ]) + ] in + if Sys.(ocaml_release.major,ocaml_release.minor) > (5,3) + then (1, return Counters)::gens (* known problem with Counters on <= 5.2: https://github.com/ocaml/ocaml/pull/13370 *) + else gens)) let next_state n _s = match n with | Stat -> ()