Re: [PATCH] ORBit memory alignment bug



On Fri, 2002-10-04 at 04:18, Michael Meeks wrote:
> 	Have you tried the --alignment=8 parameter to valgrind ? I imagine
> that's what you want :-)

D'oh - yes :)

> 	We should assert fail if alignment is not to 8 bytes; if that's not
> working - it needs fixing; we should also flag the valgrind argument in
> that warning IMHO. 

Then please consider the attached patch.

-- 
Hans Petter
Index: src/orb/GIOP/giop-recv-buffer.c
===================================================================
RCS file: /cvs/gnome/ORBit2/src/orb/GIOP/giop-recv-buffer.c,v
retrieving revision 1.56
diff -u -r1.56 giop-recv-buffer.c
--- src/orb/GIOP/giop-recv-buffer.c	5 Aug 2002 11:58:21 -0000	1.56
+++ src/orb/GIOP/giop-recv-buffer.c	4 Oct 2002 18:42:02 -0000
@@ -805,7 +805,11 @@
 	 * so we can align to the memory address rather than the offset
 	 * into the buffer.
 	 */
-	g_assert (((gulong)buf->message_body & 0x3) == 0);
+	if (((gulong) buf->message_body & 0x7) != 0) {
+		g_error ("Memory must be 8 byte aligned. "
+			 "Use 'valgrind --alignment=8'?");
+	}
+
 	buf->free_body = TRUE;
 	buf->cur = buf->message_body + 12;
 	buf->end = buf->cur + body_size;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]