Skip to content

Commit 7b1779a

Browse files
authored
flambda-backend: Port value_kind changes to testsuite/tools to fix parsecmm.mly (#1060)
failure in github CI with 32-bit tests
1 parent 49505d1 commit 7b1779a

File tree

3 files changed

+17
-6
lines changed

3 files changed

+17
-6
lines changed

testsuite/tools/parsecmm.mly

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ let make_switch n selector caselist =
4343
List.iter (fun pos -> index.(pos) <- i) posl;
4444
actv.(i) <- (e, dbg)
4545
done;
46-
Cswitch(selector, index, actv, dbg)
46+
Cswitch(selector, index, actv, dbg, value_kind ())
4747

4848
let access_array base numelt size =
4949
match numelt with
@@ -228,7 +228,8 @@ expr:
228228
| LPAREN binaryop expr expr RPAREN { Cop($2, [$3; $4], debuginfo ()) }
229229
| LPAREN SEQ sequence RPAREN { $3 }
230230
| LPAREN IF expr expr expr RPAREN
231-
{ Cifthenelse($3, debuginfo (), $4, debuginfo (), $5, debuginfo ()) }
231+
{ Cifthenelse($3, debuginfo (), $4, debuginfo (), $5, debuginfo (),
232+
value_kind ()) }
232233
| LPAREN SWITCH INTCONST expr caselist RPAREN { make_switch $3 $4 $5 }
233234
| LPAREN WHILE expr sequence RPAREN
234235
{
@@ -239,21 +240,21 @@ expr:
239240
Cconst_int (x, _) when x <> 0 -> $4
240241
| _ -> Cifthenelse($3, debuginfo (), $4, debuginfo (),
241242
(Cexit(lbl0,[])),
242-
debuginfo ()) in
243+
debuginfo (), value_kind ()) in
243244
Ccatch(Nonrecursive, [lbl0, [], Ctuple [], debuginfo ()],
244245
Ccatch(Recursive,
245246
[lbl1, [], Csequence(body, Cexit(lbl1, [])), debuginfo ()],
246-
Cexit(lbl1, []))) }
247+
Cexit(lbl1, []), value_kind ()), value_kind ()) }
247248
| LPAREN EXIT IDENT exprlist RPAREN
248249
{ Cexit(find_label $3, List.rev $4) }
249250
| LPAREN CATCH sequence WITH catch_handlers RPAREN
250251
{ let handlers = $5 in
251252
List.iter (fun (_, l, _, _) ->
252253
List.iter (fun (x, _) -> unbind_ident x) l) handlers;
253-
Ccatch(Recursive, handlers, $3) }
254+
Ccatch(Recursive, handlers, $3, value_kind ()) }
254255
| EXIT { Cexit(0,[]) }
255256
| LPAREN TRY sequence WITH bind_ident sequence RPAREN
256-
{ unbind_ident $5; Ctrywith($3, $5, $6, debuginfo ()) }
257+
{ unbind_ident $5; Ctrywith($3, $5, $6, debuginfo (), value_kind ()) }
257258
| LPAREN VAL expr expr RPAREN
258259
{ let open Asttypes in
259260
Cop(Cload (Word_val, Mutable), [access_array $3 $4 Arch.size_addr],

testsuite/tools/parsecmmaux.ml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,3 +60,11 @@ let debuginfo ?(loc=Location.symbol_rloc ()) () =
6060
~scopes:Scoped_location.empty_scopes loc
6161
)
6262
)
63+
64+
let value_kind () =
65+
(* CR-someday poechsel: As the value_kind is only used when building cmm
66+
for the first time, its precise value is not important afterward.
67+
For now we can say that the cmm code read by parsecmm will only contain
68+
Pgenval and it should make no difference, but this should probably be
69+
fixed. *)
70+
Cmm.Vval Lambda.Pgenval

testsuite/tools/parsecmmaux.mli

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,5 @@ type error =
2929
exception Error of error
3030

3131
val report_error: error -> unit
32+
33+
val value_kind : unit -> Cmm.value_kind

0 commit comments

Comments
 (0)