[Bug tree-optimization/102650] [12 Regression] Dead Code Elimination Regression at -O3 (trunk vs 11.2.0)

rguenth at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Jan 20 09:20:14 GMT 2022


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

--- Comment #7 from Richard Biener <rguenth at gcc dot gnu.org> ---
Actually e will not be used uninitialized

    for (; d < 1; d++)
        e = f + a;

will initialize it since d is zero and its value will be 4.  But jump
threading isolates the case where we would access e uninitialized.
So yes, it does seem worth doing that but maybe only on isolated paths
(to not defeat uninit diagnostics and also to remove spurious uninit
diagnostics).  The situation isn't easily visible from the threader
itself and the question is how much GCC itself will expose unconditional
uninit uses (there are some bugs around ifcombine doing that) so it's
prone to producing wrong-code as well.

That said, we probably have to live with this regression for GCC 12 and
could look into sanitizing our undef behavior for GCC 13 somehow.


More information about the Gcc-bugs mailing list