This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: g++ and aliasing bools


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".

Thus for any discussion of cxx_get_alias_set, addresses DON'T MATTER.
All that matters are types and nothing else.

Now, if the compiler can separately determine that two accesses can never
have overlapping addresses, it can assume that these accesses do not
alias.  But that needs to be handled elsewhere in the compiler, and not
by xxx_get_alias_set.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]