This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
Patch: FYI: Fix PR java/18091
- From: Tom Tromey <tromey at redhat dot com>
- To: Java Patch List <java-patches at gcc dot gnu dot org>
- Cc: Gcc Patch List <gcc-patches at gcc dot gnu dot org>
- Date: 20 Jan 2005 19:33:02 -0700
- Subject: Patch: FYI: Fix PR java/18091
- Reply-to: tromey at redhat dot com
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;