------- Comment #13 from rguenth at gcc dot gnu dot org 2008-06-11 14:29
-------
Note that the documentation of may_alias is extremely confusing IMHO (and
c_common_get_alias_set is wrong).
"Accesses to objects with types with this attribute are not subjected to
type-based alias analysis, but are instead assumed to be able to alias
any other type of objects, just like the @code{char} type."
the "char type" is not special, but instead you are allowed to access all
memory via an _lvalue_ of character type!
The above suggests that
long __attribute__((__may_alias__)) x;
*(short *)&x;
is ok, but it is not.
A better wording would be to say
"Accesses through pointers to types with this attribute are not subject
to type-based alias analysis, but are instead assumed to be able to alias
any other type of objects. These lvalue expressions are treated like
having a character type. ..."
"Note that an object of a type with this attribute does not have any
special semantics."
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36369