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

--- Comment #11 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Richard Biener <rgue...@gcc.gnu.org>:

https://gcc.gnu.org/g:a2755339c6c9832467c573d956e91565943ecdc1

commit r15-7652-ga2755339c6c9832467c573d956e91565943ecdc1
Author: Richard Biener <rguent...@suse.de>
Date:   Thu Feb 20 13:37:05 2025 +0100

    tree-optimization/118521 - bogus diagnostic from unreachable code

    When SCCP does final value replacement we end up with unfolded IL like

    __result_274 = _150 + 1;
    ...
    __new_finish_106 = __result_274 + 3;  <-- from SCCP
    _115 = _150 + 4;
    if (__new_finish_106 != _115)

    this does only get rectified by the next full folding which happens
    in forwprop4 which is after the strlen pass emitting the unwanted
    diagnostic.  The following mitigates this case in a similar way as
    r15-7472 did for PR118817 - by ensuring we have the IL folded.
    This is done by simply folding all immediate uses of the former
    PHI def that SCCP replaces.  All other more general approaches have
    too much fallout at this point.

            PR tree-optimization/118521
            * tree-scalar-evolution.cc (final_value_replacement_loop):
            Fold uses of the replaced PHI def.

            * g++.dg/torture/pr118521.C: New testcase.

Reply via email to