#150 CLISP+readline = core dump

segfault
closed-fixed
clisp (525)
5
2006-05-17
2003-03-27
No

I'm running CLISP 2.30 on FreeBSD-Current with libreadline 4.2. It dumps core when I e.g. enter "(multiple" and then press TAB

Backtrace says the following:

(gdb) backtrace
#0 0x0807a483 in lisp_completion ()
#1 0x0807a794 in lisp_completion_matches ()
#2 0x2827509e in rl_complete_internal () from /usr/lib/libreadline.so.4
#3 0x2827392c in rl_complete () from /usr/lib/libreadline.so.4
#4 0x2827b46f in _rl_dispatch () from /usr/lib/libreadline.so.4
#5 0x2827b10f in readline_internal_char () from /usr/lib/libreadline.so.4
#6 0x2827b235 in readline_internal_char () from /usr/lib/libreadline.so.4
#7 0x2827b26e in readline_internal_char () from /usr/lib/libreadline.so.4
#8 0x2827adad in readline () from /usr/lib/libreadline.so.4
#9 0x0807a934 in rd_ch_terminal3 ()

Program terminated with signal 11, Segmentation fault.

Discussion

  • Sam Steingold

    Sam Steingold - 2003-03-27
    • labels: --> clisp
    • assigned_to: nobody --> sds
    • milestone: --> segfault
     
  • Sam Steingold

    Sam Steingold - 2003-03-27

    Logged In: YES
    user_id=5735

    see also <http://clisp.cons.org/wanted.html#completion>.
    are you using gcc3?
    did you install libsigsegv?
    what happens when you set SAFETY=2 in src/lispbibl.d?

     
  • Daniel Knapp

    Daniel Knapp - 2003-03-27

    Logged In: YES
    user_id=120985

    I had this problem at one point, nobody was ever able to explain it to me but I did find a fix: If your ~/.inputrc contains the line "set comment-begin #", comment that out or remove it. Hopefully this will work for you.

     
  • Julian Stecklina

    Logged In: YES
    user_id=448338

    > If your ~/.inputrc contains the line "set comment-begin #", comment that
    >out

    Uh.. I do not have an .inputrc

    >are you using gcc3?
    gcc (GCC) 3.2.2 [FreeBSD] 20030205 (release)

    >did you install libsigsegv?
    I just did. the problem changes to Stack overflow.

    >what happens when you set SAFETY=2 in src/lispbibl.d?
    Everything works just fine. So it is really the problem described in
    http://article.gmane.org/gmane.lisp.clisp.general/1524

    Strange indeed. thanks anyway. :)

    did you install libsigsegv?
    what happens when you set SAFETY=2 in src/lispbibl.d?

     
  • Sam Steingold

    Sam Steingold - 2003-03-27

    Logged In: YES
    user_id=5735

    could you please try to investigate this issue more?
    (e.g., build --with-debug but change SAFETY to 1 in Makefile).-

     
  • Sam Steingold

    Sam Steingold - 2003-03-28
    • assigned_to: sds --> haible
     
  • Sam Steingold

    Sam Steingold - 2003-03-28

    Logged In: YES
    user_id=5735

    I now believe that this is a GCC bug.
    the bug manifests itself with
    CFLAGS = -W -Wswitch -Wcomment -Wpointer-arith -Wimplicit
    -Wreturn-type -fomit-frame-pointer -Wno-sign-compare -O2 -g
    -DUNICODE -DEXPORT_SYSCALLS -DDYNAMIC_FFI -falign-functions=4
    but not with
    CFLAGS = -W -Wswitch -Wcomment -Wpointer-arith -Wimplicit
    -Wreturn-type -fomit-frame-pointer -Wno-sign-compare -O0 -g
    -DUNICODE -DEXPORT_SYSCALLS -DDYNAMIC_FFI -falign-functions=4
    the only difference being -O2 vs -O0.
    gcc (GCC) 3.2.1 20021207 (Red Hat Linux 8.0 3.2.1-2)
    Bruno, could you please submit a GCC bug report?
    Thanks!

     
  • Sam Steingold

    Sam Steingold - 2003-04-17

    Logged In: YES
    user_id=5735

    this bug might be related to bug 723097
    <https://sourceforge.net/tracker/index.php?func=detail&aid=723097&group_id=1355&atid=101355>
    i.e., this might be a problem with the FFI (which is used
    for callback here).

     
  • Sam Steingold

    Sam Steingold - 2003-04-20

    Logged In: YES
    user_id=5735

    when all of CLISP is compiled normally (i.e., -O2
    -fexpensive-optimizations)
    but stream.c is compiled with -falign-functions=4 instead,
    the bug
    disappears, i.e., completion works just fine.
    the difference is:
    -falign-functions=4 ==> works
    -falign-functions=4 -O1 ==> broken

     
  • Jörg Höhle

    Jörg Höhle - 2003-04-23

    Logged In: YES
    user_id=377168

    I have a patch to lisp_completion() waiting for me to
    receive enough Karma to enable cvs updates. It fixes a bug
    there, which can lead to crashes, even though I don't think
    that it is involved here. Yet readline users should test it.

    To Sam's hypothesis: I don't believe it's related to the FFI
    crashes. begin/end_callback() is completely unrelated to
    libcallback of ffcall. It just means to restore/save
    precious registers, e.g. STACK.

    To Sam again: I don't understand your latest message.
    -O2 -ffalign=4 on stream.d works??
    -O1 -ffalign=4 breaks
    -O0 -ffalign=4 works
    ?

     
  • Sam Steingold

    Sam Steingold - 2003-04-25

    Logged In: YES
    user_id=5735

    1. your patch does not fix this bug.

    2. -O0 works. -O1, -O2, -O3, -O123 do NOT.

     
  • Jörg Höhle

    Jörg Höhle - 2003-04-30

    Logged In: YES
    user_id=377168

    Following an intuition, I added --with-dynamic-modules on a
    normal build (-O2 etc.). This causes no register variable
    (ebx) to be
    allocated for STACK (so it is presumably slower). Completion
    then works. So that's another work-around (instead of e.g.
    -O0).

    Smells like a possible GCC bug.

    BTW,
    stream.d: In function `lisp_completion':
    stream.d:9180: warning: variable `array' might be clobbered
    by `longjmp' or `vfork'
    stream.d:9187: warning: variable `ptr' might be clobbered by
    `longjmp' or `vfork'
    stream.d:9202: warning: variable `ptr1' might be clobbered
    by `longjmp' or `vfork'
    but I don't believe this to be involved.

     
  • Sam Steingold

    Sam Steingold - 2003-05-03

    Logged In: YES
    user_id=5735

    I checked in a workaround (disabling STACK_register for GCC3).
    you still need to submit a GCC bug report.

     
  • Jörg Höhle

    Jörg Höhle - 2003-05-09

    Logged In: YES
    user_id=377168

    The bug is one in gcc, a gcc-bug-report was submitted,
    resolution is therefore pending until further notice. Please
    read
    http://article.gmane.org/gmane.lisp.clisp.devel/9914
    and the link there to gnats.

    Summary of work-arounds known so far. One of
    o compile CLISP without -O (or with -O0)
    o configure --without-unicode (no indirect jump via
    cstombs()).
    o go back to gcc-2.X (<3.0)
    o disable use of register variable for STACK (currently in
    CVS:lispbibl.d)
    o configure --with-dynamic-modules (which disables the
    register variable currently)
    o recompile only foreign.d and stream.d without -O2, after
    you built a CLISP the normal way.

    Regards,
    Jrg Hhle.

     
  • Jörg Höhle

    Jörg Höhle - 2004-04-13

    Logged In: YES
    user_id=377168

    Why did you write now a gcc bug-report that the gcc people
    immediately classified as duplicate of the well known
    and, more importantly, now closed gcc-bug #7871? My own gcc
    bug-report #10684 mentioned below was also marked (two month
    ago) as duplicate of that one.
    Does your action mean that some gcc bug still shows up under
    different situations (e.g. convert_from_foreign_array_fill,
    or lisp_completion_matches etc.), so it's not a duplicate?
    gcc-bug mailing list activity from two month ago seemed to
    suggest that they nailed down the bug for 3.3.4. Is that not
    the case for all symptoms known from compilation of CLISP?

     
  • Bruno Haible

    Bruno Haible - 2004-04-13

    Logged In: YES
    user_id=5923

    Joerg,

    Why I reported the bug? I wasn't aware that it should already be
    fixed in gcc-3.3.4. Also, the gcc people have to verify that the bug
    is gone before closing it.

    Anyway #14938 and #10684 appear to be identical, however
    #14937 may be different (because there the bug disappears
    when the nonreturning function call is removed).

    Whether gcc-3.3.4 fixes all the bugs we see regarding global
    register variables, I don't know. We'll see.

     
  • Jörg Höhle

    Jörg Höhle - 2006-05-17

    Logged In: YES
    user_id=377168

    I temporarily re-enabled STACK_register for gcc-3.3 and checked
    + gcc-3.3.5 (Ubuntu Hoary) (current CVS)
    + gcc-3.3.6 (Ubuntu Breezy) (current CVS)
    Both the readline and cast to char array crashes go away.

    I'll nevertheless leave STACK_register disabled for 3.3 in
    lispbibl.d: be conservative just in case somebody uses an
    old gcc-3.0-3.3.3. People regularly upgrading will have 3.4
    or 4.x anyway.

     
  • Jörg Höhle

    Jörg Höhle - 2006-05-17

    Logged In: YES
    user_id=377168

    thank you for your bug report.
    the bug has been fixed in the CVS tree.
    you can either wait for the next release (recommended)
    or check out the current CVS tree (see http://clisp.cons.org\)
    and build CLISP from the sources (be advised that between
    releases the CVS tree is very unstable and may not even build
    on your platform).

     
  • Jörg Höhle

    Jörg Höhle - 2006-05-17
    • assigned_to: haible --> hoehle
    • status: open --> closed-fixed
     

Log in to post a comment.