Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hashtbl.hash does not terminate on recursive lazy value #6361

Closed
vicuna opened this issue Apr 3, 2014 · 2 comments
Closed

Hashtbl.hash does not terminate on recursive lazy value #6361

vicuna opened this issue Apr 3, 2014 · 2 comments

Comments

@vicuna
Copy link

vicuna commented Apr 3, 2014

Original bug ID: 6361
Reporter: @lpw25
Status: closed (set by @xavierleroy on 2015-12-11T18:26:55Z)
Resolution: fixed
Priority: normal
Severity: minor
Version: 4.01.0
Fixed in version: 4.02.0+dev
Category: standard library

Bug description

The generic hash function does not terminate on this recursive lazy value:

        OCaml version 4.01.0

# #rectypes;;
# #print_length 4;;
# let rec x = lazy x;;
val x : 'a lazy_t as 'a = lazy (lazy (lazy (lazy ...)))
# Hashtbl.hash x;;
@vicuna
Copy link
Author

vicuna commented Apr 26, 2014

Comment author: @xavierleroy

Nasty example. Fixed in commit 14693.

@vicuna
Copy link
Author

vicuna commented May 12, 2014

Comment author: @alainfrisch

An unfortunate consequence of the fix is that a GC (which short-circuits forward pointers) run can change the hash value (of already forced lazy values).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant