[Bug c++/61004] New: [4.9/4.10 Regression] Spurious warning: dereferencing type-punned pointer
glisse at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Tue Apr 29 15:01:00 GMT 2014
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=61004
Bug ID: 61004
Summary: [4.9/4.10 Regression] Spurious warning: dereferencing
type-punned pointer
Product: gcc
Version: 4.10.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: glisse at gcc dot gnu.org
struct A{};
struct B:A{};
void f(A const&);
int main(){
B b;
f(b);
}
g++ -O2 -Wall x.cc -c
x.cc: In function 'int main()':
x.cc:6:6: warning: dereferencing type-punned pointer will break strict-aliasing
rules [-Wstrict-aliasing]
f(b);
^
I think that's perfectly valid C++...
(I don't have a 4.9 handy, I think I've been seeing this since before the
branch, but please check before confirming the bug)
More information about the Gcc-bugs
mailing list