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

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Mon Jan 12 21:24:56 EST 2015

It's supposed to be safe; the behavior in this example is definitely a

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

Posted on the dev mailing list.