Warning when compiling on NetBSD/sparc64

Martin Husemann martin at duskware.de
Sat Nov 30 20:51:54 UTC 2013


On Sat, Nov 30, 2013 at 09:11:52PM +0100, Martin Husemann wrote:
> which seems to be the sub_ddmmss macro.
> 
> And if you look carefully, you see: "rJ" (((0)) >> 32), i.e.: 0 >> 32,
> which gcc warns about. Changing that to 0UL >> 32 makes the warning go away.

The attached patch kills all warnings for me - but is this correct?
Are these values unsigned?

Martin
-------------- next part --------------
Index: longlong.h
===================================================================
RCS file: /cvsroot/src/external/lgpl3/gmp/dist/longlong.h,v
retrieving revision 1.1.1.2
diff -u -r1.1.1.2 longlong.h
--- longlong.h	29 Nov 2013 07:49:47 -0000	1.1.1.2
+++ longlong.h	30 Nov 2013 20:47:23 -0000
@@ -1746,7 +1746,7 @@
       "	addc	%r2,%3,%0"						\
 	  : "=r" (sh), "=&r" (sl)					\
 	  : "rJ" (ah), "rI" (bh), "%rJ" (al), "rI" (bl),		\
-	    "%rJ" ((al) >> 32), "rI" ((bl) >> 32)			\
+	    "%rJ" ((unsigned long)(al) >> 32), "rI" ((unsigned long)(bl) >> 32)			\
 	   __CLOBBER_CC)
 #define sub_ddmmss(sh, sl, ah, al, bh, bl) \
   __asm__ (								\
@@ -1755,7 +1755,7 @@
       "	subc	%r2,%3,%0"						\
 	  : "=r" (sh), "=&r" (sl)					\
 	  : "rJ" (ah), "rI" (bh), "rJ" (al), "rI" (bl),		\
-	    "rJ" ((al) >> 32), "rI" ((bl) >> 32)			\
+	    "rJ" ((unsigned long)(al) >> 32), "rI" ((unsigned long)(bl) >> 32)			\
 	   __CLOBBER_CC)
 #endif
 


More information about the gmp-bugs mailing list