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

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

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

commit r16-9972-gefd02f0004242f6ad3a392c5259a9ea46be4d8ce
Author: Jeff Law <[email protected]>
Date:   Tue Nov 17 06:59:15 2026 -0700

    [PR rtl-optimization/128738] Ensure code is a CONST_INT before extracting
its INTVAL

    A simplify-rtx optimization added in the gcc-16 era can trip an RTL
checking
    failure and possibly a code generation correctness bug by accessing a
register
    node as a constant integer in a compiler without RTL checking.

    The optimization in question is only valid of that object is a known
constant
    as we use the constant to create an adjusted mask, so require the object in
    question to be a CONST_INT.  All the right things just happen after that.

    Bootstrapped and regression tested on x86_64 and aarch64 overnight.

    Pushing to the trunk and given the nature of the fix, I'm going to push to
    gcc-16 now too.

            PR rtl-optimization/128738
    gcc/
            * simplify-rtx.cc (simplify_context::simplify_binary_operation_1):
            For IOR of multiple single bit bitfields, ensure the second operand
            of OP1's AND is a CONST_INT.

    gcc/testsuite
            * gcc.dg/torture/pr128738.c: New test.

    (cherry picked from commit b6f87b7b2d286ef37c9179cb3b4c9490b8421cd7)

Reply via email to