flisp segfault on master
kamstrup opened this issue · 10 comments
Running flisp segfaults on current master (71a1cb6). OS is Ubuntu 12.10, 64 bit. Stacktrace:
(gdb) run
Starting program: /home/kamstrup/Projects/femtolisp/flisp
fatal error:
(
Program received signal SIGSEGV, Segmentation fault.
0x000000000040930b in fl_isnumber (v=) at flisp.c:736
736 return c->type != wchartype;
(gdb) bt full
#0 0x000000000040930b in fl_isnumber (v=) at flisp.c:736
c = 0x0
#1 fl_isnumber (v=) at flisp.c:731
No locals.
#2 0x0000000000409398 in smallp (v=1) at print.c:180
No locals.
#3 0x000000000040990c in allsmallp (v=, v@entry=140737353036343) at print.c:218
n = 4
#4 0x000000000040a064 in blockindent (v=140737353036343) at print.c:259
No locals.
#5 print_pair (v=140737353036343, f=0x627100) at print.c:282
head = <optimized out>
cd = <optimized out>
op = 0x0
est = 32767
n_unindented = <optimized out>
startpos = 0
ind = <optimized out>
thistiny = -9792
after2 = 6502192
newindent = 1
lastv = <optimized out>
always = <optimized out>
nextsmall = <optimized out>
after3 = 4201284
#6 fl_print_child (f=f@entry=0x627100, v=v@entry=140737353036343) at print.c:483
name = <optimized out>
#7 0x000000000040abd4 in fl_print (f=0x627100, v=140737353036343) at print.c:852
pl = <optimized out>
#8 0x0000000000401b27 in main (argc=1, argv=0x7fffffffe0a8) at flmain.c:66
fname_buf = "/home/kamstrup/Projects/femtolisp/flisp.boot\000\177\000\000\000\000\000\000\001\000\000\000\202\b\000\000\001\000\000\000\300o\336\367\001\000\000\000@\346\377\367\377\177\000\000`\335\377\377\377\177\000\000\207\360\226|\000\000\000\000H\223\375\367\377\177\000\000\060\336\377\377\377\177\000\000\370\331\377\367\377\177\000\000\063E\336\367\377\177\000\000\000\000\000\000\000\000\000\000H\223\375\367\377\177\000\000\001", '\000' <repeats 15 times>, "\001\000\000\000\377\177\000\000\370\331\377\367\377\177\000\000\000\000\000\000\000\000\000\000I\t@", '\000' <repeats 15 times>"\340, \267\377\377\377\377\377\377\377\377", '\000' <repeats 20 times>, "@\346\377\367\377\177\000\000@\260/\000\001", '\000' <repeats 11 times>"\260, \063\256\367\377\177\000\000<\247\335\367\377\177\000\000\000\340\255\367\377\177\000\000\204\207\336\367\377\177\000\000\001", '\000' <repeats 15 times>...
str = <optimized out>
exedir = <optimized out>
args = {140737353036101, 6511318}
_ctx = {buf = {{__jmpbuf = {140737488345776, 1578295438339500356, 4201284, 140737488347296, 0, 0, -1578295437153507004, 1578295988940990788}, __mask_was_saved = 0, __saved_mask = {
__val = {140737353978072, 140737354115480, 140737348771596, 140737344895480, 140737351924356, 4294967296, 2, 4, 140737354116808, 2090266759, 140737351926446,
140737353978072, 140733193388039, 140737488346400, 4294967295, 140737344842872}}}}, sp = 0, frame = 0, ngchnd = 2, rdst = 0x0, prev = 0x0}
l__tr = <optimized out>
l__ca = 1
What is your locale setting? Also, could you set a breakpoint in fl_raise
before running? Thanks for the report.
Woops, deleted last trace with breakpoint, that was from a source tree with my own feeble attempt at a fix ;-) Coming up with a clean trace.
Wow, this is most odd. Suddenly I can't reproduce anymore. All I did was 'make' and './flisp'... most odd. Even tried on a clean checkout and it works like a charm. I'll investigate some more.
I can reproduce it:
Program received signal SIGSEGV, Segmentation fault. fl_isnumber (f=0x68fa58, v=140737488344120) at flisp.c:736 736 return c->type != wchartype; (gdb) bt #0 fl_isnumber (f=0x68fa58, v=140737488344120) at flisp.c:736 #1 smallp (f=0x68fa58, v=140737488344120) at print.c:180 #2 allsmallp (f=0x68fa58, v=140737488344120) at print.c:218 #3 blockindent (f=0x68fa58, v=140737488344120) at print.c:259 #4 print_pair (f=0x68fa58, v=140737488344120) at print.c:282 #5 0x000000000042b32a in fl_print_child (f=0x68fa58, v=140737488344120) at print.c:483 #6 0x00000000004249bd in fl_print (f=0x68fa58, v=140737488344120) at print.c:852 #7 0x0000000000440a5d in main (argc=1, argv=0x7fffffffdb78) at flmain.c:66
echo $LANG -> C
I am also getting a segmentation fault.
(gdb) run
Starting program: /home/robru/Applications/femtolisp/femtolisp/flisp
warning: no loadable sections found in added symbol-file system-supplied DSO at 0x7ffff7ffa000
fatal error:
(
Program received signal SIGSEGV, Segmentation fault.
0x000000000040939b in fl_isnumber ()
(gdb) bt
#0 0x000000000040939b in fl_isnumber ()
#1 0x0000000000409428 in smallp ()
#2 0x000000000040999c in allsmallp ()
#3 0x000000000040a0f4 in fl_print_child ()
#4 0x000000000040ac74 in fl_print ()
#5 0x0000000000401bc7 in main ()
Hope this helps. Let me know if you need any more info (er, and how to get it...).
$ echo $LANG
en_CA.UTF-8
I just pulled latest trunk and can no longer reproduce this. Thanks!
Reproduced in master.
some kind of 'type_error' got 1 instead of 'function' followed by crash in 'catch' block
Any ideas?
Thanks, mike
(gdb) r
Starting program: /home/mike/github/femtolisp/flisp unittest.lsp
Breakpoint 2, fl_raise (e=140737353032295) at flisp.c:166
166 fl_lasterror = e;
(gdb) t
[Current thread is 1 (process 3148)]
(gdb) bt
#0 fl_raise (e=140737353032295) at flisp.c:166
#1 0x0000000000401eae in type_error (fname=0x42453b "apply", expected=0x425173 "function", got=1) at flisp.c:210
#2 0x000000000040d08a in _applyn (n=1) at flisp.c:638
#3 0x000000000040d2fa in fl_applyn (n=1, f=1) at flisp.c:675
#4 0x000000000041d7a5 in main (argc=2, argv=0x7fffffffe2c8) at flmain.c:54
(gdb) c
Continuing.
fatal error:
(
Program received signal SIGSEGV, Segmentation fault.
0x000000000040d788 in fl_isnumber (v=1) at flisp.c:737
737 return c->type != wchartype;
(gdb) bt
#0 0x000000000040d788 in fl_isnumber (v=1) at flisp.c:737
#1 0x0000000000409b92 in smallp (v=1) at print.c:180
#2 0x0000000000409d98 in allsmallp (v=140737353032343) at print.c:218
#3 0x0000000000409f08 in blockindent (v=140737353032295) at print.c:259
#4 0x000000000040a11d in print_pair (f=0x632100, v=140737353032295) at print.c:282
#5 0x000000000040ac9c in fl_print_child (f=0x632100, v=140737353032295) at print.c:483
#6 0x000000000040c289 in fl_print (f=0x632100, v=140737353032295) at print.c:858
#7 0x000000000041d818 in main (argc=2, argv=0x7fffffffe2c8) at flmain.c:59
ubuntu 14.04 LTS 64 bit
$ uname -a
Linux 3.15.0-031500rc7-generic #201405251935 SMP Sun May 25 23:36:23 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
$ gcc --version
gcc (Ubuntu 4.8.2-19ubuntu1) 4.8.2
Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
(gdb) file flisp
Reading symbols from /home/zack/femtolisp/flisp...done.
(gdb) run
Starting program: /home/zack/femtolisp/flisp
Missing separate debuginfo for /lib64/ld-linux-x86-64.so.2
Try: zypper install -C "debuginfo(build-id)=afa98667969782208459e394f8c8f87ac7510710"
Missing separate debuginfo for /lib64/libm.so.6
Try: zypper install -C "debuginfo(build-id)=35d35d9ce781be3a140a34242d998498615b021f"
Missing separate debuginfo for /lib64/libc.so.6
Try: zypper install -C "debuginfo(build-id)=881176f957e2887122be7fac9c3b69cd64ad707d"
fatal error:
(
Program received signal SIGSEGV, Segmentation fault.
0x0000000000409a5b in fl_isnumber ()
(gdb) c
Continuing.
Program terminated with signal SIGSEGV, Segmentation fault.
The program no longer exists.
(gdb)
Just in case anyone cares: For me this behavior was caused by flisp.boot
being truncated to 0
length at some point during build. Just git checkout flisp.boot
made the error go away.
If this is no longer reproducible or is fixed, we should close this issue.