[racket-dev] segfault with #%variable-reference

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Tue Jan 13 14:00:31 EST 2015

It wasn't that I forgot to implement pieces, after all. The problem was
a bug in the byte compiler's handling of `#%variable-reference` when
inlining. I've pushed a repair.

At Mon, 12 Jan 2015 19:24:56 -0700, Matthew Flatt wrote:
> It's supposed to be safe; the behavior in this example is definitely a
> bug.
> 
> The `#%variable-reference` form used to work only on top-level and
> module variables. It seems that I forgot to fill in some pieces when I
> made `#%variable-reference` work on local bindings (several years ago,
> mainly for use with `variable-reference-constant?` in the expansion of
> certain keyword-function forms).
> 
> Thanks for the report!
> 
> At Mon, 12 Jan 2015 19:31:52 -0500, Jon Zeppieri wrote:
> > I'm not sure if #%variable-reference is supposed to be unsafe or not
> > (it's not mentioned in the documentation), but it looks like an
> > attempt to get the location of an identifier that is neither top-level
> > nor module-level results in a hard crash:
> > 
> > ===
> > #lang racket/base
> > 
> > (define (go)
> >   (define foo 3)
> >   (#%variable-reference foo))
> > 
> > (go)
> > _________________________
> >   Racket Developers list:
> >   http://lists.racket-lang.org/dev
> _________________________
>   Racket Developers list:
>   http://lists.racket-lang.org/dev

Posted on the dev mailing list.