[Bug target/126513] [15,16,17] ICE ‘v erify_gimple’ failed, since __builtin_ppc_a tomic_cas_local added in r17-1992

"cvs-commit at gcc dot gnu.org via Gcc-bugs" <[email protected]>
Newsgroups gmane.comp.gcc.bugs
Message-ID <[email protected]/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126513

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

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

commit r16-9563-gd042b0db4bcdafe2362a86cd958dc8f2645b10e9
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.

    (cherry picked from commit c31b7a09eea3c33bccca12bab4a7bb6b01da1ff6)
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.