This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/36369] [4.3/4.4 Regression] may_alias broken with previous uses of non attributed type in some cases
- From: "rguenth at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 11 Jun 2008 14:29:11 -0000
- Subject: [Bug middle-end/36369] [4.3/4.4 Regression] may_alias broken with previous uses of non attributed type in some cases
- References: <bug-36369-87@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- 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