Valgrind 4.13.0 in SDK 18.08 seems not to work properly - regression from SDK 1.6
Context
I have this buggy sample C file leak.c
from The Valgrind Quick Start Guide:
#include <stdlib.h>
void f(void) {
int* x = malloc(10 * sizeof(int));
x[10] = 0;
}
int main(void) {
f();
return 0;
}
host$ gcc -g -O0 leak.c -o leak
host$ valgrind --leak-check=yes ./leak
==10191== Memcheck, a memory error detector
==10191== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==10191== Using Valgrind-3.14.0 and LibVEX; rerun with -h for copyright info
==10191== Command: ./leak
==10191==
==10191== Invalid write of size 4
==10191== at 0x401144: f (leak.c:4)
==10191== by 0x401155: main (leak.c:7)
==10191== Address 0x4a3b068 is 0 bytes after a block of size 40 alloc'd
==10191== at 0x483880B: malloc (vg_replace_malloc.c:299)
==10191== by 0x401137: f (leak.c:3)
==10191== by 0x401155: main (leak.c:7)
==10191==
==10191==
==10191== HEAP SUMMARY:
==10191== in use at exit: 40 bytes in 1 blocks
==10191== total heap usage: 1 allocs, 0 frees, 40 bytes allocated
==10191==
==10191== 40 bytes in 1 blocks are definitely lost in loss record 1 of 1
==10191== at 0x483880B: malloc (vg_replace_malloc.c:299)
==10191== by 0x401137: f (leak.c:3)
==10191== by 0x401155: main (leak.c:7)
==10191==
==10191== LEAK SUMMARY:
==10191== definitely lost: 40 bytes in 1 blocks
==10191== indirectly lost: 0 bytes in 0 blocks
==10191== possibly lost: 0 bytes in 0 blocks
==10191== still reachable: 0 bytes in 0 blocks
==10191== suppressed: 0 bytes in 0 blocks
==10191==
==10191== For counts of detected and suppressed errors, rerun with: -v
==10191== ERROR SUMMARY: 2 errors from 2 contexts (suppressed: 0 from 0)
host$ flatpak run --devel --filesystem=$PWD org.freedesktop.Sdk/x86_64/1.6
sh-4.3$ rm -f leak; gcc -g -O0 leak.c -o leak
sh-4.3$ valgrind --leak-check=yes ./leak
==9== Memcheck, a memory error detector
==9== Copyright (C) 2002-2015, and GNU GPL'd, by Julian Seward et al.
==9== Using Valgrind-3.12.0 and LibVEX; rerun with -h for copyright info
==9== Command: ./leak
==9==
==9== Invalid write of size 4
==9== at 0x400514: f (leak.c:4)
==9== by 0x400525: main (leak.c:7)
==9== Address 0x4c27068 is 0 bytes after a block of size 40 alloc'd
==9== at 0x4A07EBD: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==9== by 0x400507: f (leak.c:3)
==9== by 0x400525: main (leak.c:7)
==9==
==9==
==9== HEAP SUMMARY:
==9== in use at exit: 40 bytes in 1 blocks
==9== total heap usage: 1 allocs, 0 frees, 40 bytes allocated
==9==
==9== 40 bytes in 1 blocks are definitely lost in loss record 1 of 1
==9== at 0x4A07EBD: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==9== by 0x400507: f (leak.c:3)
==9== by 0x400525: main (leak.c:7)
==9==
==9== LEAK SUMMARY:
==9== definitely lost: 40 bytes in 1 blocks
==9== indirectly lost: 0 bytes in 0 blocks
==9== possibly lost: 0 bytes in 0 blocks
==9== still reachable: 0 bytes in 0 blocks
==9== suppressed: 0 bytes in 0 blocks
==9==
==9== For counts of detected and suppressed errors, rerun with: -v
==9== ERROR SUMMARY: 2 errors from 2 contexts (suppressed: 0 from 0)
host$ flatpak run --devel --filesystem=$PWD org.freedesktop.Sdk/x86_64/18.08
sh-4.4$ rm -f leak; gcc -g -O0 leak.c -o leak
sh-4.4$ valgrind --leak-check=yes ./leak
==9== Memcheck, a memory error detector
==9== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==9== Using Valgrind-3.13.0 and LibVEX; rerun with -h for copyright info
==9== Command: ./leak
==9==
==9== Conditional jump or move depends on uninitialised value(s)
==9== at 0x401D248: ??? (in /usr/lib/x86_64-linux-gnu/ld-2.27.so)
==9== by 0x40081DC: ??? (in /usr/lib/x86_64-linux-gnu/ld-2.27.so)
==9==
==9== Conditional jump or move depends on uninitialised value(s)
==9== at 0x401D46E: ??? (in /usr/lib/x86_64-linux-gnu/ld-2.27.so)
==9== by 0x2D34365F3638782E: ???
==9== by 0x6E672D78756E696B: ???
==9== by 0x6972676C61762F74: ???
==9== by 0x65727067762F646D: ???
==9== by 0x726F635F64616F6B: ???
==9== by 0x2D3436646D612D64: ???
==9== by 0x6F732E78756E696B: ???
==9==
==9== Conditional jump or move depends on uninitialised value(s)
==9== at 0x401D46E: ??? (in /usr/lib/x86_64-linux-gnu/ld-2.27.so)
==9== by 0x400B580: ??? (in /usr/lib/x86_64-linux-gnu/ld-2.27.so)
==9==
==9==
==9== HEAP SUMMARY:
==9== in use at exit: 0 bytes in 0 blocks
==9== total heap usage: 0 allocs, 0 frees, 0 bytes allocated
==9==
==9== All heap blocks were freed -- no leaks are possible
==9==
==9== For counts of detected and suppressed errors, rerun with: -v
==9== Use --track-origins=yes to see where uninitialised values come from
==9== ERROR SUMMARY: 6 errors from 3 contexts (suppressed: 0 from 0)
host$ flatpak run --devel --filesystem=$PWD org.freedesktop.Sdk/x86_64/18.08
sh-4.4$ cd ./valgrind-3.14.0
sh-4.4$ ./autogen.sh
sh-4.4$ ./configure --prefix=$(dirname $PWD)/usr
sh-4.4$ make all
sh-4.4$ make install
sh-4.4$ cd ..
sh-4.4$ rm -f leak; gcc -g -O0 leak.c -o leak
sh-4.4$ ./usr/bin/valgrind --leak-check=yes ./leak
==25648== Memcheck, a memory error detector
==25648== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==25648== Using Valgrind-3.14.0 and LibVEX; rerun with -h for copyright info
==25648== Command: ./leak
==25648==
==25648== Invalid write of size 4
==25648== at 0x1091B7: f (leak.c:4)
==25648== by 0x1091C8: main (leak.c:7)
==25648== Address 0x4a1b068 is 0 bytes after a block of size 40 alloc'd
==25648== at 0x48347B7: malloc (vg_replace_malloc.c:299)
==25648== by 0x1091AA: f (leak.c:3)
==25648== by 0x1091C8: main (leak.c:7)
==25648==
==25648==
==25648== HEAP SUMMARY:
==25648== in use at exit: 40 bytes in 1 blocks
==25648== total heap usage: 1 allocs, 0 frees, 40 bytes allocated
==25648==
==25648== 40 bytes in 1 blocks are definitely lost in loss record 1 of 1
==25648== at 0x48347B7: malloc (vg_replace_malloc.c:299)
==25648== by 0x1091AA: f (leak.c:3)
==25648== by 0x1091C8: main (leak.c:7)
==25648==
==25648== LEAK SUMMARY:
==25648== definitely lost: 40 bytes in 1 blocks
==25648== indirectly lost: 0 bytes in 0 blocks
==25648== possibly lost: 0 bytes in 0 blocks
==25648== still reachable: 0 bytes in 0 blocks
==25648== suppressed: 0 bytes in 0 blocks
==25648==
==25648== For counts of detected and suppressed errors, rerun with: -v
==25648== ERROR SUMMARY: 2 errors from 2 contexts (suppressed: 0 from 0)
Description
-
Upgrade Valgrind to 3.14.0.
Acceptance Criteria
Valgrind produces the expected output for the leak.c sample file.