chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-users] Strange hash-table behavior in compiled code


From: Mario Domenech Goulart
Subject: Re: [Chicken-users] Strange hash-table behavior in compiled code
Date: Sun, 25 Sep 2005 18:00:42 +0000
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

On Sun, 25 Sep 2005 14:38:50 +0000 Mario Domenech Goulart <address@hidden> 
wrote:

> I'm confused about the behavior of hash tables in compiled code.
>
> $ cat ht.scm
> (let ((ht (make-hash-table string=?)))
>   (hash-table-set! ht "a" "b")
>   (print (hash-table-ref ht "a")))
>
> $ csi -script ht.scm
> b
>
> $ csc -s ht.scm
> $ csi -n       
>   _______   _     __          
>  / ___/ /  (_)___/ /_____ ___ 
> / /__/ _ \/ / __/  '_/ -_) _ \
> \___/_//_/_/\__/_/\_\\__/_//_/
>
> Version 2, Build 106 - linux-unix-gnu-unknown - [ dload ]
> (c)2000-2005 Felix L. Winkelmann
> #;1> (use ht)
> ; loading ./ht.so ...
> #f
>
> $ uname -a
> Linux mandolate 2.6.11.7 #1 Sat Apr 9 21:34:07 GMT 2005 ppc 745/755 
> PowerBook4,1 GNU/Linux
>
>
> I checked the behavior on an older Chicken version and got the expected
> result:
>
>
> $ csi -script ht.scm 
> b
>
> $ csi
>    ________    _      __            
>   / ____/ /_  (_)____/ /_____  ____ 
>  / /   / __ \/ / ___/ //_/ _ \/ __ \
> / /___/ / / / / /__/ ,< /  __/ / / /
> \____/_/ /_/_/\___/_/|_|\___/_/ /_/ 
>                                     
> Version 1, Build 63 - linux-unix-gnu-x86
> (c)2000-2004 Felix L. Winkelmann
> #;> (use ht)
> ; loading ./ht.so ...
> b
>
> $ uname -a
> Linux azile 2.6.10-5-386 #1 Tue Apr 5 12:12:40 UTC 2005 i686 GNU/Linux

Some more information.  With the 2.2 version the following happens:

$ csi -script ht.scm
b

$ csc -s ht.scm
$ csi -n
  _______   _     __          
 / ___/ /  (_)___/ /_____ ___ 
/ /__/ _ \/ / __/  '_/ -_) _ \
\___/_//_/_/\__/_/\_\\__/_//_/

Version 2, Build 2 - linux-unix-gnu-unknown - [ dload ]
(c)2000-2005 Felix L. Winkelmann
#;1> (use ht)
; loading ./ht.so ...
Error: (hash-table-ref) hash-table does not contain key
"a"
#<hash-table>

When using numbers the problem doesn't seem to occur (and doesn't occur
when using build 2.106 either).

$ cat ht.scm
(let ((ht (make-hash-table)))
  (hash-table-set! ht 1 2)
  (print (hash-table-ref ht 1)))

$ csi -script ht.scm
2

$ csc -s ht.scm
$ csi -n
  _______   _     __          
 / ___/ /  (_)___/ /_____ ___ 
/ /__/ _ \/ / __/  '_/ -_) _ \
\___/_//_/_/\__/_/\_\\__/_//_/

Version 2, Build 2 - linux-unix-gnu-unknown - [ dload ]
(c)2000-2005 Felix L. Winkelmann
#;1> (use ht)
; loading ./ht.so ...
2


Another thing that I noticed is that the csc's "-g" option doesn't seem
to be working:

$ csc -h | grep -w -- -g
    -g  -emit-debug-info        emit additional debug-information

$ csc -g -s ht.scm
csc: invalid option `-g'

Best wishes,
Mario




reply via email to

[Prev in Thread] Current Thread [Next in Thread]