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

--- Comment #15 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-15 branch has been updated by Richard Biener
<[email protected]>:

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

commit r15-10725-gc4b9eaa7cdbbd5c4665efb1993fd17a94ba75e21
Author: Richard Biener <[email protected]>
Date:   Wed Jan 7 13:18:42 2026 +0100

    middle-end/123107 - avoid invalid vector folding

    We fold (v >> CST) == { 0, 0.. } into v < { 0, 0.. } but fail to
    validate that's valid for the target.  The following adds such check,
    making sure to apply after IPA (due to offloading) and only when
    the original form wasn't valid for the target (like before vector
    lowering) or when the new form is.  In particular in this case
    we have an equality compare resulting in a non-vector which we
    can handle, but a similar LT/GT is never handled.

            PR middle-end/123107
            * fold-const.cc (fold_binary_loc): Guard (v >> CST) == { 0, 0.. }
            to v < { 0, 0.. } folding.

            * gcc.dg/torture/pr123107.c: New testcase.

    (cherry picked from commit ae0cdb01b08fb4929ef17c534f86cd9fae78e799)

Reply via email to