This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/81858] New: Wrong strict-aliasing warning
- From: "joerg dot richter at pdv-fs dot de" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 16 Aug 2017 10:05:08 +0000
- Subject: [Bug c++/81858] New: Wrong strict-aliasing warning
- Auto-submitted: auto-generated
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81858
Bug ID: 81858
Summary: Wrong strict-aliasing warning
Product: gcc
Version: 7.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: joerg.richter@pdv-fs.de
Target Milestone: ---
cat > t.cc <<EOF
struct Bar
{
bool val;
};
struct Baz : Bar
{
char buf[1];
};
template<class T> struct Quux
{
void foo() const
{
Baz baz;
if( !baz.val )
{
}
}
};
EOF
g++ -O2 -c t.cc -Wall
t.cc: In member function 'void Quux<T>::foo() const':
t.cc:16:16: warning: dereferencing type-punned pointer will break
strict-aliasing rules [-Wstrict-aliasing]
if( !baz.val )
^~~