Current-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: ongoing rump udf build failure - and strict-aliasing warnings generally



Daniel Carosone wrote:
> On Fri, Jul 18, 2008 at 06:40:22PM +0300, Antti Kantee wrote:
> > On Fri Jul 18 2008 at 17:40:05 +0300, Antti Kantee wrote:
> > > >
> > > > /home/NetBSD/HEAD/src/sys/fs/udf/udf_allocation.c:1568: warning: 
> > > > dereferencing type-punned pointer will break strict-aliasing rules
> > > >
> > > > In the course of investigating this, I was concerned to learn that we
> > > > seem to have disabled this warning for the kernel generally.  This
> > > > leads to these kinds of problems creeping in undetected, until they
> > > > crawl out from under that rock when built separately like this. 
> > >
> > > I know you can "fix" these by casting to (void *) instead of (foo **),
> > > but nobody has ever succesfully been able to explain to me a) what the
> > > warning really really means and b) how to really fix it.
> >
> > Long discussion ensued offline.  Thanks to the help of simon, apb,
> > martin et al, the conclusion was that this warning is bad (mm'kay) and
> > you should not randomly squelch it with void * casts since it breaks
> > caching assumptions that the compiler is allowed to make. 
> 
> That's all very well, and "bad, mm'kay" is about as much sense as that
> cryptic error message makes anyway.
> 
> Therefore, surely it seems therefore that one should *also* not
> squelch it with blanket -Wno-* options either.  So, do we have a brave
> volunteer who knows what he's doing to squelch them properly?

I think the short answer is "use a temporary variable of the right type"
and not to throw casts in just to stop the warnings.  This is what I
suggested to Reinoud - does his lastest change fix your build problem?

Just to build an amd64 GENERIC kernel without -fno-strict-aliasing give
167 type-punned warnings, so that brave volunteer needs to understand
the code in question and also have a bit of time up their sleeves as
well.

Cheers,
Simon.


Home | Main Index | Thread Index | Old Index