On Sat, May 22, 2010 at 6:42 PM, Eli Barzilay <e...@barzilay.org> wrote: > On May 22, Jay McCarthy wrote: >> On Sat, May 22, 2010 at 6:03 PM, Eli Barzilay <e...@barzilay.org> wrote: >> > On May 22, Matthew Flatt wrote: >> >> At Sat, 22 May 2010 06:47:44 -0400, Eli Barzilay wrote: >> >> > On May 21, j...@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".)
[I only vaguely understand it.] I think the main thing is the cast, that gets rid of the type-punned-ness, but if you just add the cast, you get a different error, so by adding the temporary variable, there's no worry that it will alias. (Also, obj_link is a complicated macro that hides some more casts and derefs.) Jay -- Jay McCarthy <j...@cs.byu.edu> Assistant Professor / Brigham Young University http://teammccarthy.org/jay "The glory of God is Intelligence" - D&C 93 _________________________________________________ For list-related administrative tasks: http://list.cs.brown.edu/mailman/listinfo/plt-dev