> int *alloczero() {
> int *p = malloc(sizeof *p);
>
> if (*p)
> *p = 0;
> return p;
> }
>
> valgrind reports 'conditional jump..'
> at line 'if (*p)', which is correct
> and easy to suppress
>
> but later whereever i read *p i get
> '..uninitialised' value errors
> eventhough it's clearly provably 0
>
> now i'm wondering how to suppress these
> warnings in a way that valgrind
> understands that *p is 0
Such [incorrect] warnings cannot be suppressed.
The memory state after the code:
if (*p)
*p = 0;
is an instance of control-dependent "re-convergent fanout",
and memcheck is not intelligent enough to recognize it.
Memcheck's "logical horizon" is too small to understand
the general concept.
Perhaps the best that you can do is modify the custom allocator
using something like:
-----
#include <valgrind.h>
if (RUNNING_ON_VALGRIND)
*p = 0;
else if (*p)
*p = 0;
-----
--
------------------------------------------------------------------------------
All of the data generated in your IT infrastructure is seriously valuable.
Why? It contains a definitive record of application performance, security
threats, fraudulent activity, and more. Splunk takes this data and makes
sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-d2d-c2
_______________________________________________
Valgrind-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/valgrind-users