https://gcc.gnu.org/bugzilla/show_bug.cgi?id=41639
Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Resolution|--- |INVALID --- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> --- >(tested on SH with a non-linux, in house runtime, implementation) The bug is in your runtime implementation I think. Which has a mismatch in the return type vs what GCC internals think these should be. Note libgcc/sync.c does: ``` #if SIZE == 1 && __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1 typedef unsigned int UQItype __attribute__((mode (QI))); DEFINE (FN, 1, UQItype) #elif SIZE == 2 && __GCC_HAVE_SYNC_COMPARE_AND_SWAP_2 typedef unsigned int UHItype __attribute__((mode (HI))); DEFINE (FN, 2, UHItype) #elif SIZE == 4 && __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 typedef unsigned int USItype __attribute__((mode (SI))); DEFINE (FN, 4, USItype) #elif SIZE == 8 && __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8 typedef unsigned int UDItype __attribute__((mode (DI))); DEFINE (FN, 8, UDItype) #elif SIZE == 16 && __GCC_HAVE_SYNC_COMPARE_AND_SWAP_16 typedef unsigned int UOItype __attribute__((mode (OI))); DEFINE (FN, 8, UOItype) ``` Which matches the internals of GCC.