[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Chicken-users] Crash in SRFI-69 eq?-hash
From: |
Chris Vine |
Subject: |
Re: [Chicken-users] Crash in SRFI-69 eq?-hash |
Date: |
Sun, 19 Aug 2018 10:25:44 +0100 |
On Sun, 19 Aug 2018 03:40:26 +0200
Thomas Chust <address@hidden> wrote:
> Hello,
>
> while trying to port some code from CHICKEN 4 to CHICKEN 5 I have just
> spent several hours tracking down a crash to a call of
> hash-table-ref/default for a table which happened to use eq? as the
> comparison function and was loaded with various types of objects as
> keys.
>
> Then I realized that eq?-hash simply cannot be called on certain types
> of objects:
>
> $ chicken-status
> [...]
> srfi-69 ....................................................... version: 0.2
> [...]
>
> $ csi
> CHICKEN
> (c) 2008-2018, The CHICKEN Team
> (c) 2000-2007, Felix L. Winkelmann
> Version 5.0.0rc1 (prerelease) (rev 9d480412)
> linux-unix-gnu-x86-64 [ 64bit dload ptables ]
>
> #;1> (import srfi-69)
> ; loading /opt/chicken/lib/chicken/9/srfi-69.import.so ...
> ; loading /opt/chicken/lib/chicken/9/srfi-69.so ...
> #;2> (eq?-hash 2/3)
> [panic] out of memory - heap has reached its maximum size - execution
> terminated
>
> Apart from fractions, complex numbers also seem to trigger the crash
> reliably.
>
> Since I don't see any obvious reason why hashing by object identity
> should be impossible for certain values, I consider this a serious
> bug :-/
It probably shouldn't crash, but since '(eq? 2 2)' is allowed to evaluate
to #f, depending on the implementation, does it matter that much? (Maybe
crashing is better than a hash function silently failing to produce a
workable hash.)