This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Does __sync_bool_compare_and_swap on ia64 have wrong return type?


According to the ia64 psABI, __sync_bool_compare_and_swap is

extern int __sync_bool_compare_and_swap (type *ptr, type old, int new);

where type may be one of signed or unsigned int, long and long long.
But gcc has

extern int __sync_bool_compare_and_swap_si (int *, int, int);
extern long __sync_bool_compare_and_swap_di (long *, long, long);
#define __sync_bool_compare_and_swap(PTR, OLD, NEW)                     \
 ((sizeof (*(PTR)) == sizeof(int))                                      \
  ? (__typeof__(*(PTR)))                                                \
    __sync_bool_compare_and_swap_si((int *)(PTR),(int)(OLD),(int)(NEW)) \
  : (__typeof__(*(PTR)))                                                \
    __sync_bool_compare_and_swap_di((long *)(PTR),(long)(OLD),(long)(NEW)))

__sync_bool_compare_and_swap in gcc may return signed or unsigned int,
 long or long long.


H.J.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]