|
From: Petr P. <the...@gm...> - 2011-11-09 16:06:33
|
Hello, I came upon this weird behaviour, which is probably best described using a sample, so here it is: http://codepad.org/7zSvMHGZ I think this line alone sums it up pretty nicely: "std::copy_backward(data + 2, data + size, data + size + 1);" (data_m was declared as "int data_m[size + 1];") When I compile the code like so: g++ Test.cpp -ggdb3 and then run valgrind with --leak-check=full on it, I get this: http://codepad.org/1fMnYMbn Again, the line "Source and destination overlap in memcpy(0x7ff00038c, 0x7ff000388, 32)" pretty much sums it up. What am I doing wrong if anything? Is this caused by std::copy_backward using memcpy and not memmove? Or is this a problem on valgrinds's side? Or perhaps none of these? :) Best regards Peter. |