"Uninitialized array" warnings by c++ with -O2
Jakub Jelinek
jakub@redhat.com
Wed Jun 7 09:28:00 GMT 2017
On Wed, Jun 07, 2017 at 12:15:54PM +0300, Kirill Yu Berezin wrote:
> Hello!
>
> I have a code snippet (actually it is a part of larger project):
That snippet invokes undefined behavior at runtime (violates C++ aliasing rules),
so just fix it, rather than bother with bugreports. E.g. look for -fstrict-aliasing
in GCC documentation, or read the C++ standard. With -fno-strict-aliasing,
which is a workaround for broken code you won't get any warnings about
uninitialized uses.
Jakub
More information about the Gcc
mailing list