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

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

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

commit r17-3175-gc31b7a09eea3c33bccca12bab4a7bb6b01da1ff6
Author: Avinash Jayakar <[email protected]>
Date:   Tue Aug 4 10:07:18 2026 +0530

    rs6000: Fix type size checks for __builtin_ppc_atomic_cas_local

    Type checks for the first 3 operands of the
    __builtin_ppc_atomic_cas_local were missed with its initial
    implementation. This patch adds the following checks
    c1. Make sure the size of first 3 operands is the same.
    c2. Do not allow function pointers as arguments.
    c3. Report error when -mno-quad-memory-atomic is used but 128 bit
    operands are used as the first 3 operands.
    c4. A separate issue was when no lhs was assigned to this builtin, ICE
would
    happen as a result of emit_cmp_and_jump_insns function dereferencing the
    target rtx which would be null. Added the check in rs6000_expand_builtin
    to allocate a reg_rtx if target is null or const0_rtx.

    Tests have been added to check all the implemented checks described
    above.
    1. pr126513-acmp-tst-1.c: Checks c1 and c2.
    2. pr126513-acmp-tst-2.c: Checks c3.
    3. pr126513-acmp-tst-3.c: Checks the ICE in c4.

    2026-08-04  Avinash Jayakar  <[email protected]>

    gcc/ChangeLog:
            PR target/126513
            * config/rs6000/rs6000-builtin.cc (rs6000_expand_builtin): Allocate
reg
            if target is null or const0_rtx.
            * config/rs6000/rs6000-c.cc (altivec_resolve_overloaded_builtin):
Add
            error handling for c1, c2 and c3 described in this commit.

    gcc/testsuite/ChangeLog:
            PR target/126513
            * gcc.target/powerpc/pr126513-acmp-tst-1.c: New test.
            * gcc.target/powerpc/pr126513-acmp-tst-2.c: New test.
            * gcc.target/powerpc/pr126513-acmp-tst-3.c: New test.

Reply via email to