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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #13 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
An optimizing compiler optimizes on the assumption that undefined behavior does
not happen.  So, if you want to keep using code that invokes undefined behavior
(which is a very bad idea), you need to be prepared to pass some extra options
that tell the compiler not to do it.
-flitefime-dse=1 or -fno-lifetime-dse in this case (the latter if you also
"assume" that object after its destruction will still contain the data you've
stored in there), -fno-aggressive-loop-optimizations, -fno-strict-aliasing, -O0
in certain cases, in some cases there just isn't an option.
The -Wuninitialized* family of warnings is able to warn in certain cases about
this problem, but you of course don't get a guarantee this will be warned about
every time.

Reply via email to