Permalink
Browse files

PR#6361: Hashtbl.hash not terminating on some lazy values w/ recursiv…

…e types

git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14693 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
  • Loading branch information...
1 parent 558f40e commit 89441430c5c92f651f379ce59b60ce00b8fb0ff0 @xavierleroy xavierleroy committed Apr 26, 2014
Showing with 5 additions and 1 deletion.
  1. +1 −0 Changes
  2. +4 −1 byterun/hash.c
View
@@ -121,6 +121,7 @@ Bug fixes:
- PR#6346: Build failure with latest version of xcode on OSX
- PR#6348: Unification failure for GADT when original definition is hidden
- PR#6352: Automatic removal of optional arguments and sequencing
+- PR#6361: Hashtbl.hash not terminating on some lazy values w/ recursive types
- fix -dsource printing of "external _pipe = ..."
(Gabriel Scherer)
- bound-checking bug in caml_string_{get,set}{16,32,64}
View
@@ -213,7 +213,7 @@ CAMLprim value caml_hash(value count, value limit, value seed, value obj)
for (i = 0, len = Wosize_val(v) / Double_wosize; i < len; i++) {
h = caml_hash_mix_double(h, Double_field(v, i));
num--;
- if (num < 0) break;
+ if (num <= 0) break;
}
break;
case Abstract_tag:
@@ -227,6 +227,9 @@ CAMLprim value caml_hash(value count, value limit, value seed, value obj)
goto again;
case Forward_tag:
v = Forward_val(v);
+ /* PR#6361: this should count as 1, otherwise we can get into a loop */
+ num--;
+ if (num <= 0) break;
goto again;
case Object_tag:
h = caml_hash_mix_intnat(h, Oid_val(v));

0 comments on commit 8944143

Please sign in to comment.