This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: g++ and aliasing bools
- From: Daniel Berlin <dan at dberlin dot org>
- To: Joe Buck <jbuck at synopsys dot COM>
- Cc: Mark Mitchell <mark at codesourcery dot com>, Neil Booth <neil at daikokuya dot demon dot co dot uk>, Paolo Carlini <pcarlini at unitus dot it>, "gcc at gcc dot gnu dot org" <gcc at gcc dot gnu dot org>
- Date: Mon, 28 Jan 2002 19:14:37 -0500 (EST)
- Subject: Re: g++ and aliasing bools
On Mon, 28 Jan 2002, Joe Buck wrote:
> Daniel writes:
> > *I* already argued that they aren't dangerous for another reason. In C,
> > since they would have the same address, they would alias. In reality,
> > in C++, they *don't* alias because they *don't* have the same address.
> > However, it's perfectly fine to say things alias that don't.
> > Thus, it's not dangerous.
>
> Excuse me, but the whole point of strict aliasing is that certain things
> are treated by the compiler based solely on their types, even if they have
> the same address (for such cases it is considered a user bug). For example,
> an access to an int can never alias an access to a float, period. If a
> user writes code that violates this rule, it is not valid ISO C or C++,
> and they need to write -fno-strict-aliasing if they want GCC to avoid
> "miscompiling".
>
Right, but this is why i said they weren't dangerous for "another"
reason.
--Dan