]> sourceware.org Git - glibc.git/commitdiff
Clear destination buffer updated by the previous run
authorH.J. Lu <hjl.tools@gmail.com>
Wed, 18 May 2016 12:48:56 +0000 (05:48 -0700)
committerH.J. Lu <hjl.tools@gmail.com>
Wed, 18 May 2016 12:51:59 +0000 (05:51 -0700)
Clear the destination buffer updated by the previous run in bench-memcpy.c
and test-memcpy.c to catch the error when the following implementations do
not copy anything.

[BZ #19907]
* benchtests/bench-memcpy.c (do_one_test): Clear the destination
buffer updated by the previous run.
* string/test-memcpy.c (do_one_test): Likewise.
* benchtests/bench-memmove.c (do_one_test): Add a comment.
* string/test-memmove.c (do_one_test): Likewise.

ChangeLog
benchtests/bench-memcpy.c
benchtests/bench-memmove.c
string/test-memcpy.c
string/test-memmove.c

index ce605c1e381759c4ae6fe9e6cdd1c7086fd7df66..5249fbecfab7d0e1e11187a79d20dd2ab3038f7d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2016-05-18  H.J. Lu  <hongjiu.lu@intel.com>
+
+       [BZ #19907]
+       * benchtests/bench-memcpy.c (do_one_test): Clear the destination
+       buffer updated by the previous run.
+       * string/test-memcpy.c (do_one_test): Likewise.
+       * benchtests/bench-memmove.c (do_one_test): Add a comment.
+       * string/test-memmove.c (do_one_test): Likewise.
+
 2016-05-17  Joseph Myers  <joseph@codesourcery.com>
 
        [BZ #20094]
index c5a71925beb42081cc9fc111a8644771c5c4a7c4..9d9e7b68790a8048312689b792a08a752c00cdf7 100644 (file)
@@ -55,6 +55,10 @@ do_one_test (impl_t *impl, char *dst, const char *src,
   size_t i, iters = INNER_LOOP_ITERS;
   timing_t start, stop, cur;
 
+  /* Must clear the destination buffer set by the previous run.  */
+  for (i = 0; i < len; i++)
+    dst[i] = 0;
+
   if (CALL (impl, dst, src, len) != MEMCPY_RESULT (dst, len))
     {
       error (0, 0, "Wrong result in function %s %p %p", impl->name,
index c38596b41e3376b302cf7e45e7d7fac58cf7f118..3858f2ac52dcaca6600087cffd41fd1bbba383e8 100644 (file)
@@ -70,6 +70,7 @@ do_one_test (impl_t *impl, char *dst, char *src, const char *orig_src,
   size_t i, iters = INNER_LOOP_ITERS;
   timing_t start, stop, cur;
 
+  /* This also clears the destination buffer set by the previous run.  */
   memcpy (src, orig_src, len);
 #ifdef TEST_BCOPY
   CALL (impl, src, dst, len);
index 2a0994ca98eb6bab646beaf82f818c896580f15a..cb072f86749c42589b8bb48f24e45312ec499c45 100644 (file)
@@ -53,6 +53,12 @@ static void
 do_one_test (impl_t *impl, char *dst, const char *src,
             size_t len)
 {
+  size_t i;
+
+  /* Must clear the destination buffer set by the previous run.  */
+  for (i = 0; i < len; i++)
+    dst[i] = 0;
+
   if (CALL (impl, dst, src, len) != MEMCPY_RESULT (dst, len))
     {
       error (0, 0, "Wrong result in function %s %p %p", impl->name,
index d2ab3f3c8d54b20314071b8f5e9240045cb148b0..43433297e543e1045b8fa7c80a9490474086f5f5 100644 (file)
@@ -68,6 +68,7 @@ static void
 do_one_test (impl_t *impl, char *dst, char *src, const char *orig_src,
             size_t len)
 {
+  /* This also clears the destination buffer set by the previous run.  */
   memcpy (src, orig_src, len);
 #ifdef TEST_BCOPY
   CALL (impl, src, dst, len);
This page took 0.189703 seconds and 5 git commands to generate.