Re: [racket-dev] repeatable segfault in expander

2011-09-20 Thread Matthew Flatt
Fix pushed.

At Tue, 20 Sep 2011 11:04:46 -0400, Sam Tobin-Hochstadt wrote:
> The below program segfaults the expander, but not the compiler (tested
> with git HEAD):
> 
> [samth@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  
> #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 ,
> 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 ,
> eb=0, new_thread=0, dyn_state=0x0)
> at ../../../racket/gc2/../src/fun.c:1128
> #22 0x0809da48 in scheme_top_level_do (k=0x807d600 , eb=0)
> at ../../../racket/gc2/../src/fun.c:1041
> #23 0x08082a4b in do_local_expand (name=0x8264e28 "local-expand", for_stx=0,
> catch_lifts=, 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 ,
> 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  to continue, or q  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_e

[racket-dev] repeatable segfault in expander

2011-09-20 Thread Sam Tobin-Hochstadt
The below program segfaults the expander, but not the compiler (tested
with git HEAD):

[samth@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  
#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 ,
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 ,
eb=0, new_thread=0, dyn_state=0x0)
at ../../../racket/gc2/../src/fun.c:1128
#22 0x0809da48 in scheme_top_level_do (k=0x807d600 , eb=0)
at ../../../racket/gc2/../src/fun.c:1041
#23 0x08082a4b in do_local_expand (name=0x8264e28 "local-expand", for_stx=0,
catch_lifts=, 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 ,
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  to continue, or q  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 0x0812991