[Bug c++/40560] New: Erroneous aliasing rules message
yuri at tsoft dot com
gcc-bugzilla@gcc.gnu.org
Fri Jun 26 16:44:00 GMT 2009
When I compile the following code with gcc-4.4.0 with "-O3 -Wall" flags I get
the messages below.
Testcase has 'union' between Z and char types therefore such type conversion
should be allowed by aliasing rules.
--- error message ---
pr.C: In member function ÂZ& X::get()Â:
pr.C:12: warning: dereferencing type-punned pointer will break strict-aliasing
rules
--- testcase ---
struct Z {int ii;};
struct X {
union {
Z objs[1];
char bb[20];
};
Z& get() {
return (*(Z*)&bb[0]); // <--- error message here
}
};
--
Summary: Erroneous aliasing rules message
Product: gcc
Version: 4.4.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: yuri at tsoft dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40560
More information about the Gcc-bugs
mailing list