s3: Fix a typed-punned warning

Volker Lendecke Volker.Lendecke at SerNet.DE
Mon Feb 14 04:44:35 MST 2011

On Mon, Feb 14, 2011 at 10:30:33PM +1100, Andrew Bartlett wrote:
> Does adding the void * actually help with the type
> punning, or is this just about the warning?
> As far as I understand it, the void * here just shuts up the compiler.
> Should we consider -fno-strict-alising (so we can instead rely on the
> casting), or perhaps see if the higher levels of -Wstrict-aliasing=n put
> out less warnings?

Last time I looked up the warnings and read about the
type-punned warnings I had gotten the impression that
casting via void * prevents the compiler from performing
certain optimizations that assume any object is only ever
being referenced by one type of pointer. (void *) and (char
*) are the two pointer types that break this assumption.

I don't have the reference handy anymore. I can look it up
again if required.

With best regards,

Volker Lendecke

SerNet GmbH, Bahnhofsallee 1b, 37081 Göttingen
phone: +49-551-370000-0, fax: +49-551-370000-9
AG Göttingen, HRB 2816, GF: Dr. Johannes Loxen

More information about the samba-technical mailing list