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



On Fri Jul 18 2008 at 17:40:05 +0300, Antti Kantee wrote:
> > /home/NetBSD/obj/p4/home/NetBSD/HEAD/src/tooldir.NetBSD-4.99.69-i386/bin/i386--netbsdelf-gcc
> >  -O0 -g -Wno-pointer-sign -DUDF_READWRITE -DDEBUG -DDIAGNOSTIC 
> > -ffreestanding -Wall -Wstrict-prototypes -Wmissing-prototypes 
> > -Wpointer-arith -Wno-sign-compare -Wno-traditional -Wreturn-type -Wswitch 
> > -Wshadow -Wcast-qual -Wwrite-strings -Wextra -Wno-unused-parameter 
> > -std=gnu99  -Werror -march=nocona -O2 -pipe -fstack-protector 
> > -Wstack-protector --param ssp-buffer-size=1  
> > -I/home/NetBSD/HEAD/src/sys/rump/include  
> > -I/home/NetBSD/HEAD/src/sys/rump/fs/lib/libudf -I. -D_KERNEL 
> > -I/home/NetBSD/HEAD/src/common/include -D_RUMPKERNEL -nostdinc 
> > -I/home/NetBSD/HEAD/src/sys   -nostdinc -isystem 
> > /home/NetBSD/obj/p4/home/NetBSD/HEAD/src/destdir.i386/usr/include -c    
> > /home/NetBSD/HEAD/src/sys/fs/udf/udf_allocation.c -o udf_allocation.o
> > 
> > /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.  It should be
fixed by being less cast-happy (unless, of course, you are really brave
and really really know what you're doing).

HTH & HAND


Home | Main Index | Thread Index | Old Index