On Tue, Nov 03, 2026 at 09:25:46AM +0530, Avinash Jayakar wrote:
> The __builtin_ppc_atomic_cas_local builtin was incorrectly casting
> pointer arguments to unsigned integer types in the overload
> resolution handler, while the actual builtin definitions expected
> signed types. This caused C++ compilation to fail with "invalid
> conversion" errors due to C++'s stricter type checking, while C
> compilation succeeded due to its more permissive pointer
> conversion rules.
> 
> The fix changes the intermediate casting types in rs6000-c.cc to
> use signed types that match the builtin signatures in
> rs6000-builtins.def.
> 
> This patch also adds cc and cpp extensions to powerpc.exp to accept
> c++ tests.
> 
> Bootstrapped and regtested on powerpc64le-linux-gnu. Ok for trunk?
> Also since this is an error on valid code in C++, can we backport it
> for branches 16 and 15?
> 
> 2026-11-02  Avinash Jayakar  <[email protected]>
> 
> gcc/ChangeLog:
>       * config/rs6000/rs6000-c.cc (altivec_resolve_overloaded_builtin): Use
>       signed types intead of unsigned for atomic_cas_local builtin casts.
> 
> gcc/testsuite/ChangeLog:
>       * gcc.target/powerpc/acmp-tst.cc: New test.
>       * gcc.target/powerpc/acmp-tst-32bit.cc: New test.
>       * gcc.target/powerpc/acmp-tst-indexed.cc: New test
>       * gcc.target/powerpc/powerpc.exp: Accept c++ tests.

This looks ok for the master branch.  After a burn-in period you can
back port it to the older active branches where it is an issue.

-- 
Michael Meissner, IBM
PO Box 98, Ayer, Massachusetts, USA, 01432
email: [email protected]

Reply via email to