PATCH: Does __sync_bool_compare_and_swap on ia64 have wrong return type?

H. J. Lu hjl@lucon.org
Wed Apr 23 23:11:00 GMT 2003


On Wed, Apr 23, 2003 at 03:43:42PM -0700, Richard Henderson wrote:
> On Wed, Apr 23, 2003 at 03:33:55PM -0700, H. J. Lu wrote:
> > __sync_bool_compare_and_swap in gcc may return signed or unsigned int,
> >  long or long long.
> 
> That's a paste-o from __sync_val_compare_and_swap.
> 

Is this patch in order then?

H.J.
-------------- next part --------------
2003-04-23  H.J. Lu <hjl@gnu.org>

	* config/ia64/ia64intrin.h (__sync_bool_compare_and_swap): Make
	return type to be int.

--- gcc/config/ia64/ia64intrin.h.type	Sun Jan 20 18:24:02 2002
+++ gcc/config/ia64/ia64intrin.h	Wed Apr 23 16:06:38 2003
@@ -22,10 +22,8 @@ extern int __sync_bool_compare_and_swap_
 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_si((int *)(PTR),(int)(OLD),(int)(NEW))	\
+  : (int) __sync_bool_compare_and_swap_di((long *)(PTR),(long)(OLD),(long)(NEW)))
 
 extern void __sync_lock_release_si (int *);
 extern void __sync_lock_release_di (long *);


More information about the Gcc-patches mailing list