|
From: Kevyn-Alexandre P. <ka...@ro...> - 2012-06-14 17:46:05
|
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 |