https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105013

--- Comment #4 from James Allwright <jamesallwright at yahoo dot co.uk> ---
I have re-run with the suggested options --track-origins=yes and -s :

 $ valgrind --track-origins=yes -s ./bug
==16956== Memcheck, a memory error detector
==16956== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==16956== Using Valgrind-3.15.0 and LibVEX; rerun with -h for copyright info
==16956== Command: ./bug
==16956== 
out = 
command = 
==16956== Conditional jump or move depends on uninitialised value(s)
==16956==    at 0x1092DB: example_func (bug.c:37)
==16956==    by 0x1090D3: main (bug.c:44)
==16956==  Uninitialised value was created by a stack allocation
==16956==    at 0x109280: example_func (bug.c:26)
==16956== 
==16956== 
==16956== HEAP SUMMARY:
==16956==     in use at exit: 0 bytes in 0 blocks
==16956==   total heap usage: 1 allocs, 1 frees, 1,024 bytes allocated
==16956== 
==16956== All heap blocks were freed -- no leaks are possible
==16956== 
==16956== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)
==16956== 
==16956== 1 errors in context 1 of 1:
==16956== Conditional jump or move depends on uninitialised value(s)
==16956==    at 0x1092DB: example_func (bug.c:37)
==16956==    by 0x1090D3: main (bug.c:44)
==16956==  Uninitialised value was created by a stack allocation
==16956==    at 0x109280: example_func (bug.c:26)
==16956== 
==16956== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)

When I run with --expensive-definedness-checks=yes, no problems are
reported:

$ valgrind --expensive-definedness-checks=yes ./bug
==16924== Memcheck, a memory error detector
==16924== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==16924== Using Valgrind-3.15.0 and LibVEX; rerun with -h for copyright info
==16924== Command: ./bug
==16924== 
out = 
command = 
==16924== 
==16924== HEAP SUMMARY:
==16924==     in use at exit: 0 bytes in 0 blocks
==16924==   total heap usage: 1 allocs, 1 frees, 1,024 bytes allocated
==16924== 
==16924== All heap blocks were freed -- no leaks are possible
==16924== 
==16924== For lists of detected and suppressed errors, rerun with: -s
==16924== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)

Reply via email to