Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Strict-aliasing warnings



Wayne Davison wrote:
> 
> --zYM0uCDKw75PZbzx
> Content-Type: text/plain; charset=us-ascii
> Content-Disposition: inline
> 
> I'm using a version of gcc 3.3 to compile zsh, and it is spitting out a
> bunch of warnings like this:
> 
> warning: dereferencing type-punned pointer will break strict-aliasing rules
> 
> The attached patch silences these warnings, but I'm not sure if this is
> the right way to fix these.

Seems unlikely that changing a (HashNode) cast to (void *) when the
formal argument really is a HashNode would improve things.

The warning is highly obscure but my guess is it's worried because it
doesn't know that the type we're looking at really does look like a HashNode.

Or maybe it's more sinister than that and it's saying it may actually
break HashNode's which are really pointers to other nodes in the same
format.

We could of course rewrite the code to embed real HashNode's at the front
of anything which goes into the hasher.

-- 
Peter Stephenson <pws@xxxxxxx>                  Software Engineer
CSR Ltd., Science Park, Milton Road,
Cambridge, CB4 0WH, UK                          Tel: +44 (0)1223 692070



**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.

This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.

www.mimesweeper.com
**********************************************************************



Messages sorted by: Reverse Date, Date, Thread, Author