[Bug c/50284] possible miscompilation with -fstrict-aliasing
rguenth at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Sat Sep 3 20:53:00 GMT 2011
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50284
--- Comment #3 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-09-03 20:52:49 UTC ---
struct Value {
struct jsval data;
};
...
struct jsval y = t3.array[i];
struct Value *z = (struct Value*)&y;
if (z->data.tag == 0xFFFFFF85) {
that's invalid in GCCs reading of 6.5 p7. jsval is a subset of Value's
alias-set
but not the other way around. GCC reads z->data.tag as an access to an
object of type Value which is invalid.
The contorted reasoning is that the pointer conversion invokes undefined
behavior. Definitely an interesting blog post ;)
More information about the Gcc-bugs
mailing list