This is the mail archive of the gcc-patches@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]

Patch: FYI: Fix PR java/18091


I'm checking this in on the trunk as obvious.
This avoids a valgrind message in some cases.

Tom

Index: ChangeLog
from  Andrew Pinski  <pinskia@gcc.gnu.org>

	PR java/18091:
	* jcf-write.c (perform_relocations): Don't call memcpy if source
	and destination are the same.

Index: jcf-write.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/jcf-write.c,v
retrieving revision 1.158
diff -u -r1.158 jcf-write.c
--- jcf-write.c 24 Nov 2004 11:41:38 -0000 1.158
+++ jcf-write.c 21 Jan 2005 02:35:24 -0000
@@ -1,5 +1,5 @@
 /* Write out a Java(TM) class file.
-   Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004
+   Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
    Free Software Foundation, Inc.
 
 This file is part of GCC.
@@ -2794,7 +2794,9 @@
 	  int n = (old_ptr - old_buffer) - start;
 	  new_ptr -= n;
 	  old_ptr -= n;
-	  if (n > 0)
+	  /* Don't "copy" bytes in place, this causes valgrind
+	     warnings.  */
+	  if (n > 0 && new_ptr != old_ptr)
 	    memcpy (new_ptr, old_ptr, n);
 	  if (old_ptr == old_buffer)
 	    break;


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