Skip to content

Commit

Permalink
Fix mutable skipping in recursive mode (#15)
Browse files Browse the repository at this point in the history
  • Loading branch information
SkySkimmer committed Nov 4, 2023
2 parents bc4c635 + aaf62a8 commit 886c17f
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/tac2compile.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1004,7 +1004,8 @@ let rec get_dependencies ((visited, skipped_mut, knl) as acc) kn =
kndeps
(KNset.add kn visited, skipped_mut, knl)
in
(visited, skipped_mut, kn :: knl)
let knl = if data.gdata_mutable then knl else kn :: knl in
(visited, skipped_mut, knl)

let warn_skipped_mut = CWarnings.create ~name:"tac2compile-skipped-mutable" ~category:CWarnings.CoreCategories.ltac2
(fun skipped_mut ->
Expand Down Expand Up @@ -1121,6 +1122,7 @@ let compile ~recursive knl =
if recursive then get_recursive_kns knl
else knl
in
debug Pp.(fun () -> str "Compiling constants " ++ prlist_with_sep spc (Tac2print.pr_tacref Id.Set.empty) knl);
let file, ch, prefix = get_ml_filename () in
let kns, exts, pp = pp_code recursive prefix knl in
let fch = Format.formatter_of_out_channel ch in
Expand Down
1 change: 1 addition & 0 deletions tests/_CoqProject
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ bug_10107.v
minibench.v
compiler_bug_4.v
compiler_bug_6.v
compiler_bug_14.v
11 changes: 11 additions & 0 deletions tests/compiler_bug_14.v
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
From Ltac2 Require Import Ltac2.
Ltac2 mutable mut : unit := ().
Ltac2 test () := match mut with () => () end.

From Ltac2Compiler Require Import Ltac2Compiler.

Ltac2 Compile test.
(*
Dynlink error: execution of module initializers in the shared library failed:
File "plugins/ltac2/tac2env.ml", line 79, characters 2-8: Assertion failed
*)

0 comments on commit 886c17f

Please sign in to comment.