Attempting to use a tuple that contains a reference to itself as a key in a hashtable causes a stack overflow. See value.c:tuple_hash1 and value.c:raw_value_hash1 and the problem is rather obvious but the solution is not. How should a cyclic value be hashed? Should $1:(a, $1) and $2:(a, $2) be considered equal?