Bug 413642 - gcc 9 with -O2 results in false positive: Uninitialised value was created by a stack allocation
Summary: gcc 9 with -O2 results in false positive: Uninitialised value was created by ...
Status: REPORTED
Alias: None
Product: valgrind
Classification: Developer tools
Component: memcheck (show other bugs)
Version: 3.15 SVN
Platform: Debian unstable Linux
: NOR normal
Target Milestone: ---
Assignee: Julian Seward
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-10-30 17:03 UTC by Tim Rühsen
Modified: 2019-10-30 17:03 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tim Rühsen 2019-10-30 17:03:20 UTC
SUMMARY
Valgrind falsely detects "Uninitialised value was created by a stack allocation" when the code is compiled with gcc 9 and -O2 (with -O0 all is fine).

It looks like it's about how gcc optimizes strcmp().

STEPS TO REPRODUCE
All is pretty well described (incl. dgb assembler dumps) at
https://gitlab.com/gnutls/libtasn1/issues/9

OBSERVED RESULT
==15173== Conditional jump or move depends on uninitialised value(s)
==15173==    at 0x1092C0: main (Test_choice.c:122)
==15173==  Uninitialised value was created by a stack allocation
==15173==    at 0x1090F0: main (Test_choice.c:28)

EXPECTED RESULT
No report at all - the variable is being initialized in a called function.

SOFTWARE/OS VERSIONS
Debian unstable, but also reported on Fedora. Key seems to be gcc 9.

ADDITIONAL INFORMATION
https://gitlab.com/gnutls/libtasn1/issues/9