[Bug middle-end/38486] Missing warning about type punning
rguenth at gcc dot gnu dot org
gcc-bugzilla@gcc.gnu.org
Fri Dec 12 10:12:00 GMT 2008
------- Comment #4 from rguenth at gcc dot gnu dot org 2008-12-12 10:11 -------
Yes. Though you have to be careful not to create false positives for
float f;
struct X { int i; };
struct X *p = (struct X *)&f;
float *q = (float *)&p->i;
return *q;
if the code is obfuscated enough that the definition of p is not visible.
Or, one could even say that creating VIEW_CONVERT_EXPR <float> (p->i) is
an invalid transformation and causes an alias violation. Do we do this
transformation in this case? I think we should avoid doing it here
(that is, whenever the expression we view-convert contains a pointer
dereference).
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38486
More information about the Gcc-bugs
mailing list