STINNER Victor <vstin...@python.org> added the comment:
> ==6832== at 0x4D87E9: PyUnicode_Decode (unicodeobject.c:3395) This warning is a false alarm: the GCC builtin strcmp() function seems to read past the NUL byte. When recompiling Python with -fno-builtin GCC option, the warning is gone. The valgrind warning can be reproduced using attached valgrind_strcmp_warn.c: On Fedora 30 with: * gcc (GCC) 9.2.1 20190827 (Red Hat 9.2.1-1) * valgrind-3.15.0 GCC builtin strcmp() emits a false alarm in valgrind: it reads past the NUL byte. $ gcc -O3 valgrind_strcmp_warn.c -o valgrind_strcmp_warn -D NDEBUG=1 -g && valgrind ./valgrind_strcmp_warn (...) ==29173== Conditional jump or move depends on uninitialised value(s) ==29173== at 0x4011CB: PyUnicode_Decode.part.0 (valgrind_strcmp_warn.c:276) ==29173== by 0x4898F42: (below main) (in /usr/lib64/libc-2.29.so) ==29173== ==29173== Conditional jump or move depends on uninitialised value(s) ==29173== at 0x4011EE: PyUnicode_Decode.part.0 (valgrind_strcmp_warn.c:280) ==29173== by 0x4898F42: (below main) (in /usr/lib64/libc-2.29.so) ==29173== ==29173== Conditional jump or move depends on uninitialised value(s) ==29173== at 0x401221: PyUnicode_Decode.part.0 (valgrind_strcmp_warn.c:282) ==29173== by 0x4898F42: (below main) (in /usr/lib64/libc-2.29.so) (...) ==29173== ERROR SUMMARY: 3 errors from 3 contexts (suppressed: 0 from 0) versus $ gcc -O3 valgrind_strcmp_warn.c -o valgrind_strcmp_warn -D NDEBUG=1 -fno-builtin -g && valgrind ./valgrind_strcmp_warn ==29217== Memcheck, a memory error detector (...) ==29217== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0) ---------- title: Valgrind warnings when running tokenize.py -> Valgrind warning in PyUnicode_Decode: false alarm with GCC builtin strcmp() Added file: https://bugs.python.org/file48647/valgrind_strcmp_warn.c _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue38118> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com