[Bug middle-end/125588] [17 Regression] Segmentation Fault on short initialised with complex arithmetic since r17-265

cvs-commit at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Jun 4 05:31:45 GMT 2026


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

--- Comment #9 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The trunk branch has been updated by Andrew Pinski <pinskia@gcc.gnu.org>:

https://gcc.gnu.org/g:7ec15f8a0b357e33a9c93ad25e4401dd75b7d466

commit r17-1280-g7ec15f8a0b357e33a9c93ad25e4401dd75b7d466
Author: Andrew Pinski <andrew.pinski@oss.qualcomm.com>
Date:   Wed Jun 3 17:18:56 2026 -0700

    match: Disable `if (cond) (A | CST1) : (A & ~CST1)` pattern for non-GIMPLE
[PR125588]

    r17-265-gf6f33ca83cb6b8 added a new pattern that converts:
    cond ? (A | CST1) : (A & ~CST1)
    into `(A & ~CST1) | (cond * CST1)` but fold (partly via
    fold_binary_op_with_conditional_arg) will turn
    that back into `cond ? (A | CST1) : (A & ~CST1)` in some
    cases. In those cases we get an infinite loop and a stack overflow crash.

    This fixes the problem by enabling this pattern for GIMPLE only.

    Pushed as obvious after bootstrap/test on x86_64-linux-gnu.

            PR middle-end/125588

    gcc/ChangeLog:

            * match.pd (`if (cond) (A | CST1) : (A & ~CST1)`): Enable
            for GIMPLE only.

    gcc/testsuite/ChangeLog:

            * gcc.dg/pr125588-1.c: New test.

    Signed-off-by: Andrew Pinski <andrew.pinski@oss.qualcomm.com>


More information about the Gcc-bugs mailing list