Re: [Valgrind-users] Invalid read raised with stpncpy

2012-08-13 Thread Julian Seward
Of course, it is free software, so I guess I should fix it myself. But that is not a trivial undertaking and I really do not have the time. So as this problem hits people over and over and over, I encourage those encountering it to add their voices to mine to see it fixed once, permanently.

Re: [Valgrind-users] Invalid read raised with stpncpy

2012-08-13 Thread John Reiser
On 08/13/2012 01:07 AM, Julian Seward wrote: Of course, it is free software, so I guess I should fix it myself. But that is not a trivial undertaking and I really do not have the time. So as this problem hits people over and over and over, I encourage those encountering it to add their

Re: [Valgrind-users] Invalid read raised with stpncpy

2012-08-13 Thread John Reiser
On 08/12/2012 09:08 PM, Patrick J. LoPresti wrote: ... I really do think any argument for interceptors based on speed is nonsense. Amdahl's Law says that interceptor speed does matter. Amdahl's Law also applies when slowing down operations, as well as when speeding them up. One paraphrase

Re: [Valgrind-users] Invalid read raised with stpncpy

2012-08-13 Thread Patrick J. LoPresti
On Mon, Aug 13, 2012 at 1:07 AM, Julian Seward jsew...@acm.org wrote: I lose track of what is actually required. Is it to implement, for vector loads, the same thing that you did for scalar loads? That is, don't complain about naturally aligned word size loads that partially overlap the

Re: [Valgrind-users] Invalid read raised with stpncpy

2012-08-13 Thread Patrick J. LoPresti
On Mon, Aug 13, 2012 at 8:54 AM, John Reiser jrei...@bitwagon.com wrote: In the case at hand, we are interested in string operations, not floating point. Suppose that stpncpy contributes 0.25% (1/400) of the normal running time. Then instruction-by-instruction emulation of stpncpy by

[Valgrind-users] Invalid read raised with stpncpy

2012-08-12 Thread Francis Giraldeau
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);

Re: [Valgrind-users] Invalid read raised with stpncpy

2012-08-12 Thread songbird
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);

Re: [Valgrind-users] Invalid read raised with stpncpy

2012-08-12 Thread Francis Giraldeau
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) {

Re: [Valgrind-users] Invalid read raised with stpncpy

2012-08-12 Thread Philippe Waroquiers
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

Re: [Valgrind-users] Invalid read raised with stpncpy

2012-08-12 Thread Francis Giraldeau
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

Re: [Valgrind-users] Invalid read raised with stpncpy

2012-08-12 Thread Philippe Waroquiers
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

Re: [Valgrind-users] Invalid read raised with stpncpy

2012-08-12 Thread Patrick J. LoPresti
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,

Re: [Valgrind-users] Invalid read raised with stpncpy

2012-08-12 Thread John Reiser
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

Re: [Valgrind-users] Invalid read raised with stpncpy

2012-08-12 Thread Patrick J. LoPresti
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,

Re: [Valgrind-users] Invalid read raised with stpncpy

2012-08-12 Thread John Reiser
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. --

Re: [Valgrind-users] Invalid read raised with stpncpy

2012-08-12 Thread Patrick J. LoPresti
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