This is the mail archive of the mailing list for the glibc 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]

Fix xdr.h lvalue casts

This fixes the last lvalue as cast problem in glibc when I compile on
AMD64 (I'll double check later that I didn't miss anything).

I tested that the patch generates the same code as the old code on one
file (sunrpc/rpc_cmsg.o) compiling for amd64.

The patch was done by Joseph.

Ok to commit?


2004-03-20  Joseph S. Myers  <>

	* sunrpc/rpc/xdr.h (IXDR_GET_LONG, IXDR_PUT_LONG): Do not use
	casts as lvalues.

Index: sunrpc/rpc/xdr.h
--- sunrpc/rpc/xdr.h	16 Dec 2002 02:05:49 -0000	1.27
+++ sunrpc/rpc/xdr.h	20 Mar 2004 16:42:13 -0000
@@ -262,10 +262,8 @@ struct xdr_discrim
  * and shouldn't be used any longer. Code which use this defines or longs
  * in the RPC code will not work on 64bit Solaris platforms !
-#define IXDR_GET_LONG(buf) \
-	((long)ntohl((u_long)*__extension__((u_int32_t*)(buf))++))
-#define IXDR_PUT_LONG(buf, v) \
-	(*__extension__((u_int32_t*)(buf))++ = (long)htonl((u_long)(v)))
+#define IXDR_GET_LONG(buf) ((long)IXDR_GET_U_INT32(buf))
+#define IXDR_PUT_LONG(buf, v) ((long)IXDR_PUT_INT32(buf, (long)(v)))
 #define IXDR_GET_U_LONG(buf)	      ((u_long)IXDR_GET_LONG(buf))
 #define IXDR_PUT_U_LONG(buf, v)	      IXDR_PUT_LONG(buf, (long)(v))

 Andreas Jaeger,,
  SuSE Linux AG, Maxfeldstr. 5, 90409 Nürnberg, Germany
   GPG fingerprint = 93A3 365E CE47 B889 DF7F  FED1 389A 563C C272 A126

Attachment: pgp00000.pgp
Description: PGP signature

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