Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Strict-aliasing warnings
- X-seq: zsh-workers 19449
- From: Wayne Davison <wayned@xxxxxxxxxxxxxxxxxxxxx>
- To: Peter Stephenson <pws@xxxxxxx>
- Subject: Re: Strict-aliasing warnings
- Date: Thu, 19 Feb 2004 02:50:13 -0800
- Cc: Zsh hackers list <zsh-workers@xxxxxxxxxx>
- In-reply-to: <1728.1077186812@xxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
- References: <20040219102029.GB26450@xxxxxxxxx> <1728.1077186812@xxxxxxx>
On Thu, Feb 19, 2004 at 10:33:32AM +0000, Peter Stephenson wrote:
> 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.
Kind of, but only in the context of modern aliasing restrictions. If
two aliases for a single memory location differ in type in a radical
enough manner, the compiler does not have to consider that the two
different references might affect one another. E.g. you could change a
variable from one pointer and not have that change get reflected in the
reading from another pointer (or the original variable) because the
compiler might have optimized away the memory-fetch. However, certain
casts force the compiler to be less aggressive in its optimizations
(such as (char *) and (void *)).
That is the intent of using the (void *) cast -- it _should_ let the
optimizer know that that variable needs to be refetched. However, I'm
not 100% sure that this is enough to make sure that the optimizations
are valid or if it's only enough to just silence the warnings.
..wayne..
Messages sorted by:
Reverse Date,
Date,
Thread,
Author