Bug 281828

Summary: false memmove warning: "Source and destination overlap in memcpy"
Product: [Developer tools] valgrind Reporter: Sergio Martins <smartins>
Component: memcheckAssignee: Julian Seward <jseward>
Status: RESOLVED DUPLICATE    
Severity: normal CC: tom
Priority: NOR    
Version: 3.6.0   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed In:

Description Sergio Martins 2011-09-11 21:02:09 UTC
Version:           3.6.0 (using KDE 4.7.1) 
OS:                Linux

#include <string.h>
#include <iostream>

int main()
{
  int a[4] = { 0, 1, 2, 3 };

  memmove( a, a+1, 2*sizeof(int) );
  
  std::cout << a[0];
  std::cout << a[1];
  std::cout << a[2];
  std::cout << a[3];

  return 0;
}

Results in:

==30707== Source and destination overlap in memcpy(0x7ff000080, 0x7ff000084, 8)
==30707==    at 0x4C27B46: memcpy (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==30707==    by 0x400753: main (main.cpp:8)


Reproducible: Always

Steps to Reproduce:
.

Actual Results:  
.

Expected Results:  
.

I'm using valgrind 3.6.1, glibc 2.14, gcc 4.6.1, 64 bit archlinux
Comment 1 Tom Hughes 2011-09-11 21:41:59 UTC

*** This bug has been marked as a duplicate of bug 275284 ***