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

--- Comment #4 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The trunk branch has been updated by Andrea Pinski <[email protected]>:

https://gcc.gnu.org/g:61d56c487bfad088de0265796d2f7ae3da619240

commit r17-5592-g61d56c487bfad088de0265796d2f7ae3da619240
Author: Andrea Pinski <[email protected]>
Date:   Sun Oct 25 10:58:25 2026 -0700

    gimple: Fix factor_operation_ok's type matching for functions [PR128143]

    The problem here is after r17-3822-g44c89620f73, the code to make
    sure the types match when factoring out operations, was moved after
    the check for some functions which could return true early.
    Moving the types matching code fixes the problem by not returning early.
    Also change the function args check not to return early so that
    the problem like this does not happen in the future if more code is added
    afterwards.

    Bootstrapped and tested on x86_64-linux-gnu.

            PR tree-optimization/128143

    gcc/ChangeLog:

            * gimple-match-exports.cc (factor_operation_ok): Move the
            type matching code before the function check. Also don't
            return early for some builtin functions.

    gcc/testsuite/ChangeLog:

            * gcc.dg/torture/sub-overflow-1.c: New test.

    Signed-off-by: Andrea Pinski <[email protected]>

Reply via email to