https://bugs.kde.org/show_bug.cgi?id=440893
Bug ID: 440893
Summary: False positive "uninitialzied value" error on memeory
allocated with new[]
Product: valgrind
Version: unspecified
Platform: openSUSE RPMs
OS: Linux
Status: REPORTED
Severity: normal
Priority: NOR
Component: memcheck
Assignee: [email protected]
Reporter: [email protected]
Target Milestone: ---
SUMMARY
I've seen this with versions 3.16.1 (Opensuse RPMs) and 3.17.0 (built from
source) (Note these versions are not an option in the bugtracking system)
Using this code snippet
int prod_size=256;
char *p1 = new char[prod_size];
for(int i=0;i<prod_size;i++)
{
if (*p1!=0) //<<<< Message reported here for i==0 only
abort();
p1++;
}
I get a false positive "Conditional jump or move depends on uninitialised
value" on the first element of the allocated array. Of course new[] will have
initialized the whole allocated memory block.
STEPS TO REPRODUCE
1. Compile the above snippet
2. Run it with
valgrind --tool=memcheck --vgdb=yes --vgdb-error=0 progname
3. Get uninitialized value message.
OBSERVED RESULT
Conditional jump or move depends on uninitialised value(s)
EXPECTED RESULT
No message should be produced
SOFTWARE/OS VERSIONS
Windows:
macOS:
Linux/KDE Plasma: Opensuse Leap 15.3
(available in About System)
KDE Plasma Version:
KDE Frameworks Version:
Qt Version:
ADDITIONAL INFORMATION
--
You are receiving this mail because:
You are watching all bug changes.