Hi,
Valgrind reports an invalid read, while I think the program is valid.
The program uses stpncpy() instead of strcpy():
#include string.h
#include stdlib.h
#include stdio.h
int main(int argc, char **argv) {
char *dst = (char *) calloc(4, 1);
char *src = (char *) calloc(4, 1);
Francis Giraldeau wrote:
...
Hi,
Valgrind reports an invalid read, while I think the program is valid.
The program uses stpncpy() instead of strcpy():
#include string.h
#include stdlib.h
#include stdio.h
int main(int argc, char **argv) {
char *dst =3D (char *) calloc(4, 1);
Le 2012-08-12 17:41, songbird a écrit :
Francis Giraldeau wrote:
...
Hi,
Valgrind reports an invalid read, while I think the program is valid.
The program uses stpncpy() instead of strcpy():
#include string.h
#include stdlib.h
#include stdio.h
int main(int argc, char **argv) {
On Sun, 2012-08-12 at 18:10 +0200, Francis Giraldeau wrote:
Of course you are right! Thought, I just tested without updating dst and
the problem is raised anyway. The error is not caused in the printf(),
but in the stpncpy().
String functions might be optimised very specially by the compiler
Le 2012-08-12 18:56, Philippe Waroquiers a écrit :
On Sun, 2012-08-12 at 18:10 +0200, Francis Giraldeau wrote:
Of course you are right! Thought, I just tested without updating dst and
the problem is raised anyway. The error is not caused in the printf(),
but in the stpncpy().
String functions
On Sun, 2012-08-12 at 19:15 +0200, Francis Giraldeau wrote:
I confirm this too. I did a trivial implementation of stpcpy/stpncpy
with strcpy and it do not raise the issue. Maybe they can be a basis for
an additional REDIR?
The best is to file a bug on bugzilla,
with the test program to
On Sun, Aug 12, 2012 at 11:03 AM, Philippe Waroquiers
philippe.waroqui...@skynet.be wrote:
On Sun, 2012-08-12 at 19:15 +0200, Francis Giraldeau wrote:
The best is to file a bug on bugzilla,
with the test program to reproduce the false positive
and additional details such as gcc version,
The correct fix for this problem is to set --partial-loads-ok=yes.
Perhaps not for all purposes. The original traceback for _this_ case:
==21946== Invalid read of size 8
==21946==at 0x4ECA554: __stpncpy_sse2_unaligned
(strcpy-sse2-unaligned.S:297)
implicates hand-written
On Sun, Aug 12, 2012 at 1:44 PM, John Reiser jrei...@bitwagon.com wrote:
memcheck implements intercepting re-directs for both strcpy and strncpy.
The re-directs remove the possibility of any false positive complaints,
and also are significantly faster than emulating instructions.
Therefore,
On 08/12/2012 06:44 PM, Patrick J. LoPresti wrote:
Or, you know, we could instead spend effort fixing Valgrind's machine
emulator to match the memory model of real machines.
Your idea of real machine is not the same as mine.
--
On Sun, Aug 12, 2012 at 7:10 PM, John Reiser jrei...@bitwagon.com wrote:
On 08/12/2012 06:44 PM, Patrick J. LoPresti wrote:
Or, you know, we could instead spend effort fixing Valgrind's machine
emulator to match the memory model of real machines.
Your idea of real machine is not the same
11 matches
Mail list logo