https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93301
Alexander Monakov <amonakov at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |amonakov at gcc dot gnu.org
--- Comment #7 from Alexander Monakov <amonakov at gcc dot gnu.org> ---
(you mean unreachable code, not dead code)
Nice find, this is definitely a bug. As you say, loop unswitching introduces an
unconditional use of an uninitialized variable which otherwise is conditional
and (might be) never executed. The testcase hits a problematic early-out in
is_maybe_undefined:
/* Uses in stmts always executed when the region header executes
are fine. */
if (dominated_by_p (CDI_DOMINATORS, loop->header, gimple_bb (def)))
continue;
the code does not match the comment, checking postdominators might be correct,
but not dominators.
This was introduced by r245057 for PR71691, so technically a 8/9/10 regression.
Probably worth splitting into a separate PR as this is more serious and might
be more straightforward to fix than the earlier testcases.