aboutsummaryrefslogtreecommitdiffhomepage
path: root/contrib/extraction
diff options
context:
space:
mode:
authorGravatar letouzey <letouzey@85f007b7-540e-0410-9357-904b9bb8a0f7>2003-08-28 00:39:31 +0000
committerGravatar letouzey <letouzey@85f007b7-540e-0410-9357-904b9bb8a0f7>2003-08-28 00:39:31 +0000
commit8f077fda19052919acfd32df030c40285cb28112 (patch)
treec5d8f55c484bc87c25fec4b91eb4c85998568e0f /contrib/extraction
parenta9d5724d00f5e5b90ab8e2050afe54a44a424db4 (diff)
correction d'un stack overflow possible (PR#320)
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/coq/trunk@4278 85f007b7-540e-0410-9357-904b9bb8a0f7
Diffstat (limited to 'contrib/extraction')
-rw-r--r--contrib/extraction/extraction.ml11
1 files changed, 6 insertions, 5 deletions
diff --git a/contrib/extraction/extraction.ml b/contrib/extraction/extraction.ml
index ad20e4679..a4c2cc46e 100644
--- a/contrib/extraction/extraction.ml
+++ b/contrib/extraction/extraction.ml
@@ -31,8 +31,9 @@ open Mlutil
exception I of inductive_info
-(* A flag used to avoid loops in [extract_inductive] *)
-let internal_call = ref (None : kernel_name option)
+(* A set of all inductive currently being computed,
+ to avoid loops in [extract_inductive] *)
+let internal_call = ref KNset.empty
let none = Evd.empty
@@ -283,11 +284,11 @@ and extract_type_scheme env db c p =
and extract_ind env kn = (* kn is supposed to be in long form *)
try
- if (!internal_call = Some kn) then lookup_ind kn (* Already started. *)
+ if KNset.mem kn !internal_call then lookup_ind kn (* Already started. *)
else if visible_kn kn then lookup_ind kn (* Standard situation. *)
else raise Not_found (* Never trust the table for a internal kn. *)
with Not_found ->
- internal_call := Some kn;
+ internal_call := KNset.add kn !internal_call;
let mib = Environ.lookup_mind kn env in
(* Everything concerning parameters. *)
(* We do that first, since they are common to all the [mib]. *)
@@ -374,7 +375,7 @@ and extract_ind env kn = (* kn is supposed to be in long form *)
in
let i = {ind_info = ind_info; ind_nparams = npar; ind_packets = packets} in
add_ind kn i;
- internal_call := None;
+ internal_call := KNset.remove kn !internal_call;
i
(*s [extract_type_cons] extracts the type of an inductive