]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR java/18091 (Valgrind errors building libjava)
authorAndrew Pinski <pinskia@gcc.gnu.org>
Fri, 21 Jan 2005 02:38:23 +0000 (18:38 -0800)
committerTom Tromey <tromey@gcc.gnu.org>
Fri, 21 Jan 2005 02:38:23 +0000 (02:38 +0000)
2005-01-20  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.

From-SVN: r94007

gcc/java/ChangeLog
gcc/java/jcf-write.c

index 23ebb806428c0fd0e08d745abbe93825cc2d8902..e9ddb8bc818dda02355b475e53df5681a877c424 100644 (file)
@@ -1,3 +1,9 @@
+2005-01-20  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.
+
 2005-01-17  Tom Tromey  <tromey@redhat.com>
 
        * verify-impl.c (get_short): Sign extend.
index 638f47baf858bcf74e4cdf89c4648ba76ce7cf85..8b6dc7de3282f3e7b8617429e3c9674a1bc75c02 100644 (file)
@@ -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 @@ perform_relocations (struct jcf_partial *state)
          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;