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] |
Suppose we have 3 types T1, T2, Tcom such that T1 and T2 are not compatible, but Tcom is compatible with either T1 or T2. Let's call the relationship between T1 and T2 "pseudo-compatible". Then:
Tcom x; T1 * p = (T1 *)&x; T2 * q = (T2 *)&x;
foo() { T1 x = *p; *q = ... }
This is not undefined behavior, and the standard says that p and q don't alias
in foo. But they do.
-- Mark Mitchell CodeSourcery, LLC (916) 791-8304 mark@codesourcery.com
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |