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

Comments

Projects
None yet
1 participant
@vicuna
Copy link
Collaborator

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

This comment has been minimized.

Copy link
Collaborator Author

vicuna commented Apr 26, 2014

Comment author: @xavierleroy

Nasty example. Fixed in commit 14693.

@vicuna

This comment has been minimized.

Copy link
Collaborator 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).

@vicuna vicuna closed this Dec 11, 2015

@vicuna vicuna added stdlib bug labels Mar 14, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.