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