[plt-dev] Re: [plt] Push #20286: master branch updated

From: Eli Barzilay (eli at barzilay.org)
Date: Sat May 22 20:42:57 EDT 2010

On May 22, Jay McCarthy wrote:
> On Sat, May 22, 2010 at 6:03 PM, Eli Barzilay <eli at barzilay.org> wrote:
> > On May 22, Matthew Flatt wrote:
> >> At Sat, 22 May 2010 06:47:44 -0400, Eli Barzilay wrote:
> >> > On May 21, jay at racket-lang.org wrote:
> >> > >
> >> > > src/racket/gc/new_hblk.c
> >> > > ~~~~~~~~~~~~~~~~~~~~~~~~
> >> > > --- OLD/src/racket/gc/new_hblk.c
> >> > > +++ NEW/src/racket/gc/new_hblk.c
> >> > > @@ -164,7 +164,8 @@ ptr_t GC_build_fl(struct hblk *h, size_t sz, GC_bool
> >> > clear, ptr_t list)
> >> > >     * put p (which is now head of list of objects in *h) as first
> >> > >     * pointer in the appropriate free list for this size.
> >> > >     */
> >> > > -      obj_link(h -> hb_body) = list;
> >> > > +   word *tmp = (word *)h->hb_body;
> >> > > +      obj_link(tmp) = list;
> >> > >        return ((ptr_t)p);
> >> > >  }
> >> >
> >> > It's not clear to me what this is trying to do, but this breaks on
> >> > windows.
> >>
> >> The problem is the variable declaration in the middle of a
> >> block. I'll fix it.
> >
> > (Yeah, that was clear -- but why is it needed in the first place?  The
> > only place I've seen this was due to xform limitations.)
> 
> If "it" = this patch, then it removes this error:
> 
> .../src/racket/gc/new_hblk.c:167: warning: dereferencing type-punned
> pointer will break strict-aliasing rules

Clarification: why does the temporary variable prevent that warning?
(It's a C question -- I never got the type-punned thing beyond a vague
"something related to C99".)

-- 
          ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
                    http://barzilay.org/                   Maze is Life!


Posted on the dev mailing list.