[racket-dev] [plt] Push #23267: master branch updated

From: Vincent St-Amour (stamourv at ccs.neu.edu)
Date: Tue Aug 16 14:26:36 EDT 2011

Here's the simplest example I could come up with:

In `dummy.rkt':

    #lang s-exp "dummy-lang.rkt"

In `dummy-lang.rkt':

    #lang racket/base
    (provide (rename-out (module-begin #%module-begin)))
    (require (for-syntax racket/base))

    (define-syntax (module-begin stx)
      #'(#%module-begin
         (define x 3)
         (define (f x) x x)))


Looking at the fully expanded version of `dummy.rkt' in the macro
stepper, we can see that all 3 `x's in the definition of `f' are
`bound-identifier=?', but only the first 2 (the parameter and the
first reference) are `free-identifier=?'.

Vincent


At Tue, 16 Aug 2011 11:04:13 -0600,
Jon Rafkind wrote:
> 
> Oh sorry, I meant how did the bug manifest itself in racket programs.
> 
> On 08/16/2011 11:02 AM, Jay McCarthy wrote:
> > The C macro expanded into more than a single expression, but there was
> > no {} after the else, so the latter expressions always ran.
> >
> > This is a great example :)
> >
> > Jay
> >
> > On Tue, Aug 16, 2011 at 11:00 AM, Jon Rafkind <rafkind at cs.utah.edu> wrote:
> >> What was the bug? :)
> >>
> >> On 08/16/2011 10:43 AM, mflatt at racket-lang.org wrote:
> >>> mflatt has updated `master' from d05f138ed2 to 311d55b5cf.
> >>>   http://git.racket-lang.org/plt/d05f138ed2..311d55b5cf
> >>>
> >>> =====[ 1 Commits ]======================================================
> >>>
> >>> Directory summary:
> >>>  100.0% src/racket/src/
> >>>
> >>> ~~~~~~~~~~
> >>>
> >>> 311d55b Matthew Flatt <mflatt at racket-lang.org> 2011-08-16 10:27
> >>> :
> >>> | fix bug that affects `free-identifier=?'
> >>> |
> >>> | This bug is in the "amazing that it lurked for years" category,
> >>> | as well as the "stupid use of C preprocessor" category.
> >>> :
> >>>   M src/racket/src/syntax.c |    5 +++--
> >>>
> >>> =====[ Overall Diff ]===================================================
> >>>
> >>> src/racket/src/syntax.c
> >>> ~~~~~~~~~~~~~~~~~~~~~~~
> >>> --- OLD/src/racket/src/syntax.c
> >>> +++ NEW/src/racket/src/syntax.c
> >>> @@ -365,7 +365,7 @@ XFORM_NONGCING static MZ_INLINE void DO_WRAP_POS_INC(Wrap_Pos *w)
> >>>  #define WRAP_POS_INIT_END(w) (w.l = scheme_null, w.a = NULL, w.is_limb = 0, w.pos = 0)
> >>>  #define WRAP_POS_END_P(w) SCHEME_NULLP(w.l)
> >>>  #define WRAP_POS_FIRST(w) w.a
> >>> -#define WRAP_POS_COPY(w, w2) w.l = (w2).l; w.a = (w2).a; w.is_limb= (w2).is_limb; w.pos = (w2).pos
> >>> +#define WRAP_POS_COPY(w, w2) w.l = (w2).l; w.a = (w2).a; w.is_limb = (w2).is_limb; w.pos = (w2).pos
> >>>
> >>>  /* Walking backwards through one chunk: */
> >>>
> >>> @@ -3618,8 +3618,9 @@ static Scheme_Object *resolve_env(WRAP_POS *_wraps,
> >>>    if (_wraps) {
> >>>      WRAP_POS_COPY(wraps, *_wraps);
> >>>      WRAP_POS_INC(wraps);
> >>> -  } else
> >>> +  } else {
> >>>      WRAP_POS_INIT(wraps, ((Scheme_Stx *)a)->wraps);
> >>> +  }
> >>>
> >>>    while (1) {
> >>>      if (WRAP_POS_END_P(wraps)) {
> >> _________________________________________________
> >>  For list-related administrative tasks:
> >>  http://lists.racket-lang.org/listinfo/dev
> >>
> >
> >
> 
> _________________________________________________
>   For list-related administrative tasks:
>   http://lists.racket-lang.org/listinfo/dev


Posted on the dev mailing list.