[racket-dev] repeatable segfault in expander

From: Sam Tobin-Hochstadt (samth at ccs.neu.edu)
Date: Tue Sep 20 11:04:46 EDT 2011

The below program segfaults the expander, but not the compiler (tested
with git HEAD):

[samth at punge:~/sw/plt/collects/tests/racket/benchmarks/shootout (master) plt] r
Welcome to Racket v5.1.3.9.
-> (define x '(module m racket
     (require racket/require)
     (require (filtered-in (lambda (n) foo) scheme))))
-> (compile x)
; reference to an identifier before its definition: foo in module: 'm phase: 1
-> (expand x)
SIGSEGV MAPERR si_code 1 fault on addr 0x10
Aborted

Back trace:
(gdb) where
#0  0x0012e416 in __kernel_vsyscall ()
#1  0x001a3e71 in raise (sig=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:64
#2  0x001a734e in abort () at abort.c:92
#3  0x0822ed2d in fault_handler (sn=11, si=0x876726c, ctx=0x87672ec)
at ../../../racket/gc2/sighand.c:118
#4  <signal handler called>
#5  scheme_register_unbound_toplevel (env=0xa51fec70, id=0xa5234950)
    at ../../../racket/gc2/../src/compenv.c:644
#6  0x082501ee in scheme_bind_syntaxes (where=0x8264d87 "local syntax
definition", names=0xa51fed20,
    a=0xa5234f68, exp_env=0xa5734220, insp=0xb7250828, rec=0xa75484d0,
drec=0, stx_env=0xa51fec70,
    rhs_env=0xa51fec70, _pos=0xa75484ec, rename_rib=0xa51fe9f0)
    at ../../../racket/gc2/../src/compile.c:3623
#7  0x0807e7f4 in local_eval (argc=3, argv=0xa88a6ec8) at
../../../racket/gc2/../src/eval.c:5161
#8  0x002f196a in ?? ()
#9  0x002e1094 in ?? ()
#10 0x002dfee4 in ?? ()
#11 0x002ee0a4 in ?? ()
#12 0x002e15f4 in ?? ()
#13 0x08086300 in scheme_do_eval (obj=0x0, num_rands=137223416,
rands=0xa7548a14, get_value=1)
    at ../../../racket/gc2/../src/eval.c:2688
#14 0x0809669f in apply_k () at ../../../racket/gc2/../src/fun.c:1289
#15 0x0809d858 in scheme_top_level_do_worker (k=0x8096610 <apply_k>,
eb=1, new_thread=0, dyn_state=0x0)
    at ../../../racket/gc2/../src/fun.c:1128
#16 0x0809f016 in scheme_apply_macro (name=0xa51fe278,
menv=0xa570c3c8, rator=0xa5721688,
    code=0xa51fe2f8, env=0xa51fded8, boundname=0x82a7644,
rec=0xa7548c38, drec=0, for_set=0)
    at ../../../racket/gc2/../src/fun.c:1796
#17 0x0824a02c in compile_expand_macro_app (form=0xa51fe258,
env=0xa51fded8, rec=0xa7548c38, drec=0,
    app_position=0) at ../../../racket/gc2/../src/compile.c:4324
#18 scheme_compile_expand_expr (form=0xa51fe258, env=0xa51fded8,
rec=0xa7548c38, drec=0, app_position=0)
    at ../../../racket/gc2/../src/compile.c:4791
#19 0x0824d84e in scheme_expand_expr (form=0xa51fe258, env=0xa51fded8,
erec=0xa7548c38, drec=0)
    at ../../../racket/gc2/../src/compile.c:5257
#20 0x0807d9b6 in expand_k () at ../../../racket/gc2/../src/eval.c:4201
#21 0x0809d858 in scheme_top_level_do_worker (k=0x807d600 <expand_k>,
eb=0, new_thread=0, dyn_state=0x0)
    at ../../../racket/gc2/../src/fun.c:1128
#22 0x0809da48 in scheme_top_level_do (k=0x807d600 <expand_k>, eb=0)
    at ../../../racket/gc2/../src/fun.c:1041
#23 0x08082a4b in do_local_expand (name=0x8264e28 "local-expand", for_stx=0,
    catch_lifts=<value optimized out>, for_expr=0, argc=3, argv=0xa88a6f64)
    at ../../../racket/gc2/../src/eval.c:4766
#24 0x08083379 in local_expand (argc=3, argv=0xa88a6f64) at
../../../racket/gc2/../src/eval.c:4814
#25 0x002df5f6 in ?? ()
#26 0x08086300 in scheme_do_eval (obj=0x0, num_rands=137223352,
rands=0xa7549320, get_value=1)
    at ../../../racket/gc2/../src/eval.c:2688
#27 0x0809669f in apply_k () at ../../../racket/gc2/../src/fun.c:1289
#28 0x0809d858 in scheme_top_level_do_worker (k=0x8096610 <apply_k>,
eb=1, new_thread=0, dyn_state=0x0)
    at ../../../racket/gc2/../src/fun.c:1128
#29 0x0809f016 in scheme_apply_macro (name=0xa51fdd40,
menv=0xa570bd58, rator=0xa570c388,
    code=0xa51fddc0, env=0xa5736238, boundname=0x82a7644,
rec=0xa7549668, drec=0, for_set=0)
---Type <return> to continue, or q <return> to quit---
    at ../../../racket/gc2/../src/fun.c:1796
#30 0x0824a02c in compile_expand_macro_app (form=0xa5756168,
env=0xa5736238, rec=0xa7549668, drec=0,
    app_position=0) at ../../../racket/gc2/../src/compile.c:4324
#31 scheme_compile_expand_expr (form=0xa5756168, env=0xa5736238,
rec=0xa7549668, drec=0, app_position=0)
    at ../../../racket/gc2/../src/compile.c:4791
#32 0x0824d84e in scheme_expand_expr (form=0xa5756168, env=0xa5736238,
erec=0xa7549668, drec=0)
    at ../../../racket/gc2/../src/compile.c:5257
#33 0x0812fbc0 in do_module_begin_at_phase (form=0xa57361d8,
env=0xa57349c0, rec=0xa7549ef4, drec=0,
    erec=0xa7549ef4, derec=0, phase=0, body_lists=0x82a7f1c, bxs=0xa5736208)
    at ../../../racket/gc2/../src/module.c:6610
#34 0x08132f7e in do_module_begin (orig_form=0xa5735fd8,
env=0xa57349c0, rec=0xa7549ef4, drec=0)
    at ../../../racket/gc2/../src/module.c:6264
#35 0x08134536 in module_begin_expand (form=0xa5735fd8,
env=0xa57349c0, erec=0xa7549ef4, drec=0)
    at ../../../racket/gc2/../src/module.c:7465
#36 0x0824af63 in scheme_compile_expand_expr (form=0xa5735fd8,
env=0xa57349c0, rec=0xa7549ef4, drec=0,
    app_position=0) at ../../../racket/gc2/../src/compile.c:4614
#37 0x0824d84e in scheme_expand_expr (form=0xa5735fd8, env=0xa57349c0,
erec=0xa7549ef4, drec=0)
    at ../../../racket/gc2/../src/compile.c:5257
#38 0x0812991e in do_module (form=0xa56d29f8, env=0xa56d2908,
rec=0xa7549ef4, drec=0)
    at ../../../racket/gc2/../src/module.c:5802
#39 0x0812a19f in module_expand (form=0xa56d29f8, env=0xa56d2908,
erec=0xa7549ef4, drec=0)
    at ../../../racket/gc2/../src/module.c:5879
#40 0x0824af63 in scheme_compile_expand_expr (form=0xa56d29f8,
env=0xa56d2908, rec=0xa7549ef4, drec=0,
    app_position=0) at ../../../racket/gc2/../src/compile.c:4614
#41 0x0824d84e in scheme_expand_expr (form=0xa56d29f8, env=0xa56d2908,
erec=0xa7549ef4, drec=0)
    at ../../../racket/gc2/../src/compile.c:5257
#42 0x0807d9b6 in expand_k () at ../../../racket/gc2/../src/eval.c:4201
#43 0x0809d858 in scheme_top_level_do_worker (k=0x807d600 <expand_k>,
eb=0, new_thread=0, dyn_state=0x0)
    at ../../../racket/gc2/../src/fun.c:1128
#44 0x0809da48 in scheme_top_level_do (k=0x807d600 <expand_k>, eb=0)
    at ../../../racket/gc2/../src/fun.c:1041
#45 0x0807d5eb in expand (argc=1, argv=0xa88a6f84) at
../../../racket/gc2/../src/eval.c:4430
#46 0x002df2a0 in ?? ()
#47 0x08086300 in scheme_do_eval (obj=0x0, num_rands=137223288,
rands=0x0, get_value=-1)
    at ../../../racket/gc2/../src/eval.c:2688
#48 0x0809669f in apply_k () at ../../../racket/gc2/../src/fun.c:1289
#49 0x0809d9c8 in scheme_top_level_do_worker (k=0x8096610 <apply_k>,
eb=1, new_thread=1, dyn_state=0x0)
    at ../../../racket/gc2/../src/fun.c:1128
#50 0x0809e6fd in scheme_apply_thread_thunk (rator=0xa5d62878) at
../../../racket/gc2/../src/fun.c:1327
#51 0x08206a5d in start_child (child=0xa5d62b38, child_eval=0xa5d62878)
    at ../../../racket/gc2/../src/thread.c:2806
#52 0x0820e889 in make_subprocess (child_thunk=0xa5d62878,
child_start=0xa754a60c, config=0xa5d62800,
    cells=0xa5d628a8, break_cell=0x9fc6cba0, mgr=0x0, normal_kill=1)
    at ../../../racket/gc2/../src/thread.c:2895
#53 0x0820e9de in scheme_thread_w_details (thunk=0xa754a6d0,
config=0xa754a594, cells=0xa754a6c0,
    break_cell=0xa754a6c4, mgr=0x8281717, suspend_to_kill=2673029)
    at ../../../racket/gc2/../src/thread.c:3117
#54 0xa754a69c in ?? ()


-- 
sam th
samth at ccs.neu.edu


Posted on the dev mailing list.