https://bugs.kde.org/show_bug.cgi?id=381326
Bug ID: 381326
Summary: recognize re-convergent fanout before complaining
about Uninitialized
Product: valgrind
Version: 3.13 SVN
Platform: Other
OS: Linux
Status: UNCONFIRMED
Severity: wishlist
Priority: NOR
Component: memcheck
Assignee: [email protected]
Reporter: [email protected]
Target Milestone: ---
libmusl has:
void *__malloc0(size_t n)
{
void *p = malloc(n);
if (p && !IS_MMAPPED(MEM_TO_CHUNK(p))) {
size_t *z;
n = (n + sizeof *z - 1)/sizeof *z;
for (z=p; n; n--, z++) if (*z) *z=0;
}
return p;
}
Memcheck should recognize the idiom "if (*z) *z=0;", then not complain
"Conditional jump or move depends on uninitialised value(s)". The final state
is "all initialized [and zero!]", and the two-instruction intermediate state
[Compare, Branch if already 0] has no lasting consequences.
Of course libmusl should integrate better with memcheck, but the idiom occurs
in "random" user code, too.
--
You are receiving this mail because:
You are watching all bug changes.