What steps will reproduce the problem?
#!r6rs
(import (rnrs))
(define-record-type mystruct
(fields id
state))
(define (add-a-struct! ht)
(let* ((sid 53)
(this (make-mystruct sid
(make-hashtable equal-hash equal?))))
(hashtable-set! ht sid this)
(let ((state (mystruct-state this)))
(hashtable-ref state "something" #t) ; this line makes SEGV likely
#f)))
(let ((ht1 (make-eqv-hashtable)))
(add-a-struct! ht1)
(write (hashtable-keys ht1)) ; SEGV
(newline))
What is the expected output? What do you see instead?
Expected: #(53)
Actual: segmentation fault
What version of the product are you using? On what operating system?
Mosh R6RS scheme interpreter, version 0.2.7 (mosh-0.2.7-386-g04aa167 Wed, 31
Aug 2011 22:23:19 +0900)
Linux glimworm 3.0.0-1-amd64 #1 SMP Sat Aug 27 16:21:11 UTC 2011 x86_64
GNU/Linux
Please provide any additional information below.
The problem occurs with both mosh and nmosh. Backtrace below.
Program received signal SIGSEGV, Segmentation fault.
alloc_hdr () at extlibs/gc-cvs/headers.c:177
177 hdr_free_list = (hdr *) (result -> hb_next);
(gdb) bt
#0 alloc_hdr () at extlibs/gc-cvs/headers.c:177
#1 GC_install_header (h=0x136c000) at extlibs/gc-cvs/headers.c:263
#2 0x0000000000520596 in GC_get_first_part (index=35, bytes=4096,
hhdr=0x13db050, h=0x136b000) at extlibs/gc-cvs/allchblk.c:505
#3 GC_allochblk_nth (sz=80, kind=1, flags=0, n=35, may_split=<optimized out>)
at extlibs/gc-cvs/allchblk.c:785
#4 0x0000000000520c2a in GC_allochblk (sz=80, kind=1, flags=0) at
extlibs/gc-cvs/allchblk.c:629
#5 0x00000000005294aa in GC_generic_malloc_many (lb=80, k=1, result=0x898f90)
at extlibs/gc-cvs/mallocx.c:391
#6 0x0000000000533f66 in GC_malloc (bytes=80) at
extlibs/gc-cvs/thread_local_alloc.c:159
#7 0x000000000042917f in operator new (size=80, gcp=<optimized out>,
cleanup=<optimized out>, clientData=<optimized out>) at
./extlibs/gc-cvs/include/gc_cpp.h:366
#8 operator new (gcp=UseGC, size=80, cleanup=<optimized out>,
clientData=<optimized out>) at src/VM-inl.h:177
#9 operator new [] (clientData=0x0, cleanup=0, gcp=UseGC, size=80) at
./extlibs/gc-cvs/include/gc_cpp.h:394
#10 makeObjectArray (size=10) at src/Object-inl.h:289
#11 scheme::VM::getDirectThreadedCode (this=0xa87d20, code=0xa88f00,
length=<optimized out>, isCompiler=false) at src/VM-inl.h:180
#12 0x00000000004225e8 in evaluateUnsafe (isCompiler=false, codeSize=10,
code=0xa88f00, this=0xa87d20) at src/VM.cpp:401
#13 scheme::VM::evaluateSafe (this=0xa87d20, code=0xa88f00, codeSize=10,
isCompiler=false) at src/VM.cpp:416
#14 0x000000000042386d in evaluateSafe (code=<optimized out>, this=<optimized
out>) at src/VM.cpp:432
#15 scheme::VM::callClosure1 (this=<optimized out>, closure=<optimized out>,
arg=<optimized out>) at src/VM.cpp:445
#16 0x00000000004790b5 in callHashFunction (hashFunction=<optimized out>,
key=<optimized out>) at src/GenericHashTable.cpp:47
#17 0x00000000004794fc in operator() (key=<optimized out>, this=<optimized
out>) at src/GenericMap.h:61
#18 _M_bkt_num_key (__n=193, __key=<optimized out>, this=<optimized out>) at
/usr/include/c++/4.6/backward/hashtable.h:592
#19 _M_bkt_num_key (__key=<optimized out>, this=0x12f6d80) at
/usr/include/c++/4.6/backward/hashtable.h:584
#20 _M_bkt_num (__obj=<optimized out>, this=0x12f6d80) at
/usr/include/c++/4.6/backward/hashtable.h:588
#21 operator++ (this=<synthetic pointer>) at
/usr/include/c++/4.6/backward/hashtable.h:670
#22 scheme::GenericHashTable::keys (this=0x12f6d70) at
src/GenericHashTable.cpp:147
#23 0x000000000048706a in scheme::hashtableKeysEx (theVM=0xa87d20, argc=1,
argv=<optimized out>) at src/HashTableProcedures.cpp:211
#24 0x0000000000434c25 in call (argv=<optimized out>, argc=<optimized out>,
theVM=0xa87d20, this=<optimized out>) at src/CProcedure.h:47
#25 scheme::VM::runLoop (this=0xa87d20, code=<optimized out>,
returnPoint=<optimized out>, returnTable=<optimized out>) at src/call.inc.cpp:96
#26 0x00000000004225f8 in evaluateUnsafe (isCompiler=false, codeSize=86737,
code=0xdd9000, this=0xa87d20) at src/VM.cpp:402
#27 scheme::VM::evaluateSafe (this=0xa87d20, code=0xdd9000, codeSize=86737,
isCompiler=false) at src/VM.cpp:416
#28 0x00000000004278b5 in scheme::VM::activateR6RSMode (this=0xa87d20,
image=0x5c68a0 "\004\321R\001", image_size=357737, isDebugExpand=<optimized
out>)
at src/VM.cpp:849
#29 0x000000000053785a in activateR6RSMode (vm=<optimized out>,
isDebugExpand=<optimized out>) at src/main.cpp:121
#30 0x0000000000409921 in main (argc=<optimized out>, argv=<optimized out>) at
src/main.cpp:347
<backtrace from --enable-developer>
Original issue reported on code.google.com by amoe...@gmail.com on 5 Sep 2011 at 1:54
Original issue reported on code.google.com by
amoe...@gmail.com
on 5 Sep 2011 at 1:54