seanjensengrey / mosh-scheme

Automatically exported from code.google.com/p/mosh-scheme
Other
0 stars 0 forks source link

segfault printing derived clos classes #218

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
  (import (rnrs)
          (clos user))

  (define-class <point> () x y)
  (write <point>)

What is the expected output? What do you see instead?
The program segfaults while writing the class.

What version of the product are you using? On what operating system?
Mosh R6RS scheme interpreter, version 0.2.7 (mosh-0.2.7-339-g8ecd6f5 2011/06/30 
01:58:16) 
Linux glimworm 2.6.39-2-amd64 #1 SMP Wed Jun 8 11:01:04 UTC 2011 x86_64 
GNU/Linux

Please provide any additional information below.
This is almost the same bug as #199, except that it applies to derived classes 
rather than the root class.

Backtrace:
Program received signal SIGSEGV, Segmentation fault.
GC_clear_stack (arg=0x0) at extlibs/gc-cvs/gc_misc.c:280
280     ptr_t sp = GC_approx_sp();  /* Hotter than actual sp */
#0  GC_clear_stack (arg=0x0) at extlibs/gc-cvs/gc_misc.c:280
#1  0x000000000052c4be in GC_generic_malloc_many (lb=48, k=0, result=0x89ceb8)
    at extlibs/gc-cvs/mallocx.c:427
#2  0x00000000005371af in GC_malloc_atomic (bytes=48)
    at extlibs/gc-cvs/thread_local_alloc.c:191
#3  0x000000000041ef58 in GC_selective_alloc<GC_true_type> (__beg=0x11c6ac0, 
    __end=<value optimized out>, __a=<value optimized out>)
    at ./extlibs/gc-cvs/include/gc_allocator.h:95
#4  allocate (__beg=0x11c6ac0, __end=<value optimized out>, 
    __a=<value optimized out>) at ./extlibs/gc-cvs/include/gc_allocator.h:132
#5  _S_create (__beg=0x11c6ac0, __end=<value optimized out>, 
    __a=<value optimized out>) at /usr/include/c++/4.6/bits/basic_string.tcc:609
#6  std::basic_string<int, std::char_traits<int>, gc_allocator<int> 
>::_S_construct<int const*> (__beg=0x11c6ac0, __end=<value optimized out>, 
    __a=<value optimized out>) at /usr/include/c++/4.6/bits/basic_string.tcc:140
#7  0x000000000041f455 in _S_construct_aux<int const*> (this=0x11e0ff0)
    at /usr/include/c++/4.6/bits/basic_string.h:1692
#8  _S_construct<int const*> (this=0x11e0ff0)
    at /usr/include/c++/4.6/bits/basic_string.h:1713
#9  basic_string (this=0x11e0ff0)
    at /usr/include/c++/4.6/bits/basic_string.tcc:217
#10 ucs4string (this=0x11e0ff0) at src/ucs4string.h:57
#11 scheme::Symbol::c_str (this=0x11e0ff0) at src/Symbol.cpp:149
#12 0x000000000046faac in scheme::TextualOutputPort::print<false> (
    this=0xa75e40, theVM=<value optimized out>, o=..., seen=0x0)
    at src/TextualOutputPort.cpp:531
... REPEAT LINE #12 UNTIL ...
#6903 0x000000000046d6a7 in scheme::TextualOutputPort::putDatum (this=0xa75e40, 
    theVM=0xa8cd20, o=<value optimized out>, isSharedAware=<value optimized out>)
    at src/TextualOutputPort.cpp:749

#6904 0x00000000004a5975 in scheme::writeEx (theVM=0xa8cd20, argc=1, 
    argv=0xa90088) at src/PortProcedures.cpp:1056

#6905 0x0000000000434d2b in call (this=0xa8cd20, code=<value optimized out>, 
    returnPoint=<value optimized out>, returnTable=<value optimized out>)
    at src/CProcedure.h:47
#6906 scheme::VM::runLoop (this=0xa8cd20, code=<value optimized out>, 
---Type <return> to continue, or q <return> to quit---
    returnPoint=<value optimized out>, returnTable=<value optimized out>)
    at src/call.inc.cpp:96
#6907 0x0000000000422678 in evaluateUnsafe (this=0xa8cd20, code=0xde2000, 
    codeSize=86737, isCompiler=false) at src/VM.cpp:402
#6908 scheme::VM::evaluateSafe (this=0xa8cd20, code=0xde2000, codeSize=86737, 
    isCompiler=false) at src/VM.cpp:416

#6909 0x0000000000427935 in scheme::VM::activateR6RSMode (this=0xa8cd20, 
    image=0x5ca420 "\004\321R\001", image_size=357597, 
    isDebugExpand=<value optimized out>) at src/VM.cpp:849

#6910 0x000000000053a97a in activateR6RSMode (vm=<value optimized out>, 
    isDebugExpand=<value optimized out>) at src/main.cpp:121
#6911 0x00000000004098c1 in main (argc=<value optimized out>, 
    argv=<value optimized out>) at src/main.cpp:347

Original issue reported on code.google.com by amoe...@gmail.com on 30 Jun 2011 at 9:28

GoogleCodeExporter commented 9 years ago
Since <point> is circular object, use write/ss to print it.
Fix of Issue 199 was to use write/ss on REPL.

Original comment by hige...@gmail.com on 1 Jul 2011 at 2:55