[Bug c++/71885] Incorrect code generated with -01, memset() function call is missing

eric at baculasystems dot com gcc-bugzilla@gcc.gnu.org
Fri Jul 15 08:45:00 GMT 2016


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71885

--- Comment #9 from Eric Bollengier <eric at baculasystems dot com> ---
Thanks for the "behavior is undefined" explanation. I understand a bit better
why the GCC team did this choice.

However, here, we don't talk about such kind of objects. In my case for
example, objects that uses this way of initializing the memory are always
allocated with a new(). The programmer controls that side.

I would rather prefer see some warnings about uninitialized variables when the
object allocation is automatic rather than stripping my initialization because
it doesn't work in all cases.

I would also vote to move this optimization to some -O3 -O4 level instead of
-O1.


More information about the Gcc-bugs mailing list