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

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

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

commit r16-5674-ga651bb353554ecb79898d48dd077b7cd288467df
Author: Andrew Pinski <[email protected]>
Date:   Wed Nov 26 13:55:41 2025 -0800

    reassociation: Fix canonical ordering in some cases

    This was noticed in PR122843 were sometimes reassociation
    would create the uncanonical order of operands. This fixes
    the problem by swapping the order as the rewrite happens.

    Wstringop-overflow.c needed to be xfailed since it started
    not to warn because well the warning is too dependent on
    the order of operands to MIN_EXPR. This testcase
    failed if we had supplied -fno-tree-reassoc before too;
    but nothing in the IR changes except the order of 2 operands
    of MIN_EXPR. I filed PR 122881 for this xfail.

    Bootstrapped and tested on x86_64-linux-gnu.

    gcc/ChangeLog:

            * tree-ssa-reassoc.cc (rewrite_expr_tree): Swap
            oe1 and oe2 if commutative code and not in
            canonical order.

    gcc/testsuite/ChangeLog:

            * c-c++-common/Wstringop-overflow.c: Xfail, PR 122881.

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

Reply via email to