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

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

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

commit r16-5547-gd3c11a21eea2fd1ebb90cdb55684c0182407105c
Author: Jeff Law <[email protected]>
Date:   Mon Nov 24 06:05:27 2025 -0700

    [PR rtl-optimization/122782] Fix out of range shift causing bootstrap
failure with ubsan

    As noted in the PR, we're doing a bogus shift in the new code triggering a
    ubsan failure.  This code works up through DImode and needs to reject
attempts
    at handling wider modes.  Yes, it could be extended to those wider modes
and I
    expect we will as int128 becomes more common, but it doesn't seem worth the
    effort right now.

    This patch adds the same kind of test we're using elsewhere to guard
against
    the bogus shift.  While I haven't been able to reproduce the ubsan
bootstrap
    failure, I can see the bogus shift under the debugger and I can see they no
    longer occur after this patch.

    This has been bootstrapped and regression tested on x86 and riscv.  It's
also
    been through all the crosses.  Pushing to the trunk momentarily.

    jeff

            PR rtl-optimization/122782
    gcc/
            * ext-dce.cc (ext_dct_process_uses): Guard against undefined shifts
            by properly checking modes on the input object.

Reply via email to