|
From: Kevyn-Alexandre P. <ka...@ro...> - 2012-06-14 17:46:05
Attachments:
MallocProblemO2.cxx
|
Hi, Here the problem that I have with valgrind-3.6.1-Debian (Ubuntu 11.10), valgrind-3.7.0 (Ubuntu 12.04) and on SVN version: gcc -o test MallocProblemO2.cxx valgrind --leak-check=full ./test No problem If I add the -O2 flag it result in a Invalid read of 4 bytes: gcc -O2 -o test MallocProblemO2.cxx valgrind --leak-check=full ./test ==21719== Memcheck, a memory error detector ==21719== Copyright (C) 2002-2010, and GNU GPL'd, by Julian Seward et al. ==21719== Using Valgrind-3.6.1-Debian and LibVEX; rerun with -h for copyright info ==21719== Command: ./test ==21719== ==21719== Invalid read of size 4 ==21719== at 0x4004F0: main (in /home/kapare/Documents/test) ==21719== Address 0x51d0044 is 4 bytes inside a block of size 6 alloc'd ==21719== at 0x4C279F2: calloc (vg_replace_malloc.c:467) ==21719== by 0x4004DF: main (in /home/kapare/Documents/test) ==21719== EXPECT STRLENGTH OF 4: 4 EXPECT STR "0123": 0123 ==21719== ==21719== HEAP SUMMARY: ==21719== in use at exit: 0 bytes in 0 blocks ==21719== total heap usage: 1 allocs, 1 frees, 6 bytes allocated ==21719== ==21719== All heap blocks were freed -- no leaks are possible ==21719== ==21719== For counts of detected and suppressed errors, rerun with: -v ==21719== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 4 from 4) This problem seem to be the same as this old one: https://bugzilla.redhat.com/show_bug.cgi?id=518247 I have enter a bug for the issue 301922 |
|
From: Dan K. <da...@ke...> - 2012-06-14 17:53:18
|
Kevyn-Alexandre Paré <ka...@ro...> wrote: > ==21719== Invalid read of size 4 > ==21719== at 0x4004F0: main (in /home/kapare/Documents/test) > ==21719== Address 0x51d0044 is 4 bytes inside a block of size 6 > > This problem seem to be the same as this old one: > https://bugzilla.redhat.com/show_bug.cgi?id=518247 > > I have enter a bug for the issue 301922 Is this the same as https://bugs.kde.org/show_bug.cgi?id=264936 ? I have to use --partial-loads-ok=yes myself on optimized apps built with Visual C++ for this reason. - Dan |
|
From: Kevyn-Alexandre P. <ka...@ro...> - 2012-06-14 20:10:23
|
Dan, On 2012-06-14, at 1:53 PM, Dan Kegel wrote: > Kevyn-Alexandre Paré <ka...@ro...> wrote: >> ==21719== Invalid read of size 4 >> ==21719== at 0x4004F0: main (in /home/kapare/Documents/test) >> ==21719== Address 0x51d0044 is 4 bytes inside a block of size 6 > >> This problem seem to be the same as this old one: >> https://bugzilla.redhat.com/show_bug.cgi?id=518247 >> >> I have enter a bug for the issue 301922 > > Is this the same as > https://bugs.kde.org/show_bug.cgi?id=264936 > ? I could not say? it seem that there is some similarities but I could not be sure. > > I have to use --partial-loads-ok=yes myself on optimized apps built with > Visual C++ for this reason. valgrind --leak-check=full --partial-loads-ok=yes ./test Adding the flag didn't remove the error? thx - KA > - Dan |
|
From: Patrick J. L. <lop...@gm...> - 2012-06-14 20:56:14
|
On Thu, Jun 14, 2012 at 1:10 PM, Kevyn-Alexandre Paré <ka...@ro...> wrote: > > valgrind --leak-check=full --partial-loads-ok=yes ./test > > Adding the flag didn't remove the error? Are you _sure_ it is exactly the same error? Your original report said this was the error: ==21719== Invalid read of size 4 ==21719== at 0x4004F0: main (in /home/kapare/Documents/test) ==21719== Address 0x51d0044 is 4 bytes inside a block of size 6 alloc'd For an aligned read of size 4 that is 4 bytes into a block of size 6, --partial-loads-ok=yes should definitely silence the error message. But if this is really a SSE load, it will now complain about an invalid read of size 8 because partial-loads-ok has not been implemented for 8-byte loads (https://bugs.kde.org/show_bug.cgi?id=294285). Please re-read the error message carefully and confirm? And if that is the problem, consider voting for bug 294285. - Pat P.S. In my opinion, partial-loads-ok=yes should be the default, since it correctly models how real machines behave. (Valgrind is a machine simulator, not a C interpreter... And an aligned access can never "partially fault".) This would also be a totally general fix instead of intercepting more and more library calls. But it needs to be fixed for SSE and AVX loads first, and I just have not had the time... P.P.S. --partial-loads-ok=yes used to create false negatives (https://bugs.kde.org/show_bug.cgi?id=294523), but that is fixed. |
|
From: Kevyn-Alexandre P. <ka...@ro...> - 2012-06-15 00:03:36
|
Hi Pat, I just update the bug see the result: https://bugs.kde.org/show_bug.cgi?id=301922 It seem that the version from my Ubuntu 11.10 was causing the problem because of the gcc version: gcc (Ubuntu/Linaro 4.6.1-9ubuntu3) 4.6.1 I tried with 4.7 on my debian unstable machine and the problem was not there anymore. thx -- KA On 2012-06-14, at 4:56 PM, Patrick J. LoPresti wrote: > On Thu, Jun 14, 2012 at 1:10 PM, Kevyn-Alexandre Paré > <ka...@ro...> wrote: >> >> valgrind --leak-check=full --partial-loads-ok=yes ./test >> >> Adding the flag didn't remove the error? > > Are you _sure_ it is exactly the same error? Your original report > said this was the error: > > ==21719== Invalid read of size 4 > ==21719== at 0x4004F0: main (in /home/kapare/Documents/test) > ==21719== Address 0x51d0044 is 4 bytes inside a block of size 6 alloc'd > > For an aligned read of size 4 that is 4 bytes into a block of size 6, > --partial-loads-ok=yes should definitely silence the error message. > But if this is really a SSE load, it will now complain about an > invalid read of size 8 because partial-loads-ok has not been > implemented for 8-byte loads > (https://bugs.kde.org/show_bug.cgi?id=294285). > > Please re-read the error message carefully and confirm? And if that > is the problem, consider voting for bug 294285. > > - Pat > > P.S. In my opinion, partial-loads-ok=yes should be the default, since > it correctly models how real machines behave. (Valgrind is a machine > simulator, not a C interpreter... And an aligned access can never > "partially fault".) This would also be a totally general fix instead > of intercepting more and more library calls. But it needs to be fixed > for SSE and AVX loads first, and I just have not had the time... > > P.P.S. --partial-loads-ok=yes used to create false negatives > (https://bugs.kde.org/show_bug.cgi?id=294523), but that is fixed. |