Summary: | gcc -O2 problem with SSE optimization? | ||
---|---|---|---|
Product: | [Developer tools] valgrind | Reporter: | kapare <kapare> |
Component: | memcheck | Assignee: | Julian Seward <jseward> |
Status: | REPORTED --- | ||
Severity: | normal | CC: | cwatson |
Priority: | NOR | ||
Version: | 3.7 SVN | ||
Target Milestone: | --- | ||
Platform: | Ubuntu | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | ||
Sentry Crash Report: | |||
Attachments: | Source file to reproduce the bug |
Description
kapare
2012-06-14 17:44:03 UTC
Replacing the bufferLength, in the source code previously attached, by 8 will solve the warning tested with debian unstable pacakage gcc 7.0, same result. Dan Kegel :Could this be the same problem as describe in Bug 264936 ? Test with or without --partial-loads-ok=yes rm test;gcc -O2 -o test MallocProblemO2.cxx;valgrind --leak-check=full ./test ==27633== Memcheck, a memory error detector ==27633== Copyright (C) 2002-2010, and GNU GPL'd, by Julian Seward et al. ==27633== Using Valgrind-3.6.1-Debian and LibVEX; rerun with -h for copyright info ==27633== Command: ./test ==27633== ==27633== Invalid read of size 4 ==27633== at 0x4004F0: main (in /home/kapare/Documents/test) ==27633== Address 0x51d0044 is 4 bytes inside a block of size 6 alloc'd ==27633== at 0x4C279F2: calloc (vg_replace_malloc.c:467) ==27633== by 0x4004DF: main (in /home/kapare/Documents/test) ==27633== EXPECT STRLENGTH OF 4: 4 EXPECT STR "0123": 0123 ==27633== ==27633== HEAP SUMMARY: ==27633== in use at exit: 0 bytes in 0 blocks ==27633== total heap usage: 1 allocs, 1 frees, 6 bytes allocated ==27633== ==27633== All heap blocks were freed -- no leaks are possible ==27633== ==27633== For counts of detected and suppressed errors, rerun with: -v ==27633== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 4 from 4) kapare@kapare:~/Documents$ rm test;gcc -O2 -o test MallocProblemO2.cxx;valgrind --partial-loads-ok=yes --leak-check=full ./test ==27663== Memcheck, a memory error detector ==27663== Copyright (C) 2002-2010, and GNU GPL'd, by Julian Seward et al. ==27663== Using Valgrind-3.6.1-Debian and LibVEX; rerun with -h for copyright info ==27663== Command: ./test ==27663== ==27663== Invalid read of size 4 ==27663== at 0x4004F0: main (in /home/kapare/Documents/test) ==27663== Address 0x51d0044 is 4 bytes inside a block of size 6 alloc'd ==27663== at 0x4C279F2: calloc (vg_replace_malloc.c:467) ==27663== by 0x4004DF: main (in /home/kapare/Documents/test) ==27663== EXPECT STRLENGTH OF 4: 4 EXPECT STR "0123": 0123 ==27663== ==27663== HEAP SUMMARY: ==27663== in use at exit: 0 bytes in 0 blocks ==27663== total heap usage: 1 allocs, 1 frees, 6 bytes allocated ==27663== ==27663== All heap blocks were freed -- no leaks are possible ==27663== ==27663== For counts of detected and suppressed errors, rerun with: -v ==27663== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 4 from 4) WITH LAST SVN VERSION rm test;gcc -O2 -o test MallocProblemO2.cxx;/home/kapare/VALGRIND/bin/valgrind --partial-loads-ok=yes --leak-check=full ./test ==27739== Memcheck, a memory error detector ==27739== Copyright (C) 2002-2011, and GNU GPL'd, by Julian Seward et al. ==27739== Using Valgrind-3.8.0.SVN and LibVEX; rerun with -h for copyright info ==27739== Command: ./test ==27739== ==27739== Invalid read of size 4 ==27739== at 0x4004F0: main (in /home/kapare/Documents/test) ==27739== Address 0x51d2044 is 4 bytes inside a block of size 6 alloc'd ==27739== at 0x4C28864: calloc (vg_replace_malloc.c:590) ==27739== by 0x4004DF: main (in /home/kapare/Documents/test) ==27739== EXPECT STRLENGTH OF 4: 4 EXPECT STR "0123": 0123 ==27739== ==27739== HEAP SUMMARY: ==27739== in use at exit: 0 bytes in 0 blocks ==27739== total heap usage: 1 allocs, 1 frees, 6 bytes allocated ==27739== ==27739== All heap blocks were freed -- no leaks are possible ==27739== ==27739== For counts of detected and suppressed errors, rerun with: -v ==27739== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 4 from 4) The last diff from line error from 3.6 to 3.8: 3.7 at 0x4C279F2: calloc (vg_replace_malloc.c:467) 3.8 at 0x4C28864: calloc (vg_replace_malloc.c:590) The previous test was done with gcc --version gcc (Ubuntu/Linaro 4.6.1-9ubuntu3) 4.6.1 I just tested it with gcc 7.0 on my debian machine with or without the --partial-loads-ok=yes there is no error!!!! So this seem a gcc problem will try on ubnutu 12.04 tomorrow ::: rm test;gcc --version;gcc -O2 -o test MallocProblemO2.cxx;valgrind --leak-check=full ./test gcc (Debian 4.7.0-12) 4.7.0 Copyright (C) 2012 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ==32142== Memcheck, a memory error detector ==32142== Copyright (C) 2002-2011, and GNU GPL'd, by Julian Seward et al. ==32142== Using Valgrind-3.7.0 and LibVEX; rerun with -h for copyright info ==32142== Command: ./test ==32142== EXPECT STRLENGTH OF 4: 4 EXPECT STR "0123": 0123 ==32142== ==32142== HEAP SUMMARY: ==32142== in use at exit: 0 bytes in 0 blocks ==32142== total heap usage: 1 allocs, 1 frees, 6 bytes allocated ==32142== ==32142== All heap blocks were freed -- no leaks are possible ==32142== ==32142== For counts of detected and suppressed errors, rerun with: -v ==32142== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 4 from 4) I can reproduce this with gcc 4.6.2 but not with gcc 4.7.1. |