From 970404f2bfa7a26ad64692844441261cebd80082 Mon Sep 17 00:00:00 2001 From: Kazuhiko Sakaguchi Date: Fri, 9 Aug 2019 21:19:16 +0200 Subject: [extraction] Fix #7191: Avoid unsound eta-reduction `Mlutil.simpl` and `Mlutil.atomic_eta_red` did some unsound eta-reductions as follows: (fun x0 ... xn => MLexn x0 ... xn) ->eta MLexn. `MLexn` raises an exception thus is not a value in OCaml. So the above simplification may change the behavior of extracted programs. This patch restricts `atomic_eta_red` to eta-redexes whose core is both atomic and value. Acknowledgement: This work is financially supported by Peano System Inc. on-behalf-of: @peano-system --- test-suite/output/bug7191.out | 9 +++++++++ test-suite/output/bug7191.v | 3 +++ 2 files changed, 12 insertions(+) create mode 100644 test-suite/output/bug7191.out create mode 100644 test-suite/output/bug7191.v (limited to 'test-suite') diff --git a/test-suite/output/bug7191.out b/test-suite/output/bug7191.out new file mode 100644 index 0000000000..005455e30c --- /dev/null +++ b/test-suite/output/bug7191.out @@ -0,0 +1,9 @@ + +type unit0 = +| Tt + +(** val f : unit0 -> unit0 **) + +let f _ = + assert false (* absurd case *) + diff --git a/test-suite/output/bug7191.v b/test-suite/output/bug7191.v new file mode 100644 index 0000000000..1aa4625b6c --- /dev/null +++ b/test-suite/output/bug7191.v @@ -0,0 +1,3 @@ +Require Extraction. +Definition f (x : False) : unit -> unit := match x with end. +Recursive Extraction f. -- cgit v1.2.3