dberlin added a comment.

In https://reviews.llvm.org/D30538#690699, @hans wrote:

> +1 for documenting this, but I have to leave it to the language lawyers for 
> how to fomulate it.
>
> > Enables/disables the strict aliasing assumption, which assumes that objects 
> > of different types do not share the same location in memory.
>
> I think it needs to say incompatible types at least (and `char` and `unsigned 
> char` are also special). And isn't it really about pointers -- the compiler 
> assumes that when dereferncing two pointers of incompatible types, those 
> pointers do not refer to the same memory?
>
> > clang does not allow "type-punning" by writing and reading from different 
> > union members
>
> I thought clang does allow type-punning through unions, as long as it's in a 
> single function, but that it fails when things get more complicated.


The limitation is really "union accesses must be visibly through a union, and 
if you try to trick the compiler, you will lose".
That is what we meant to allow, it just is still broken *anyway*

> +dannyb who enjoys this stuff ;)

You are so mean :)


https://reviews.llvm.org/D30538



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to