homepage

This issue tracker has been migrated to GitHub , and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author blarsen
Recipients blarsen, vstinner
Date 2020年07月03日.21:47:00
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1593812820.7.0.967275410849.issue41204@roundup.psfhosted.org>
In-reply-to
Content
In commit b1cc6ba73 from earlier today, an error-handling path can now read an uninitialized variable.
https://github.com/python/cpython/commit/b1cc6ba73a51d5cc3aeb113b5e7378fb50a0e20a#diff-fa7f27df4c8df1055048e78340f904c4R695-R697
In particular, asdl_c.py is used to generate C source, and when building that code with Clang 10, there is the attached warning.
Likely fix: initialize `fields` to `NULL`. Also, perhaps a CI loop that has `-Werror=sometimes-uninitialized` would help detect these.
Compiler warning:
Python/Python-ast.c:1147:9: warning: variable 'fields' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
 if (state == NULL) {
 ^~~~~~~~~~~~~
Python/Python-ast.c:1210:16: note: uninitialized use occurs here
 Py_XDECREF(fields);
 ^~~~~~
./Include/object.h:520:51: note: expanded from macro 'Py_XDECREF'
#define Py_XDECREF(op) _Py_XDECREF(_PyObject_CAST(op))
 ^~
./Include/object.h:112:41: note: expanded from macro '_PyObject_CAST'
#define _PyObject_CAST(op) ((PyObject*)(op))
 ^~
Python/Python-ast.c:1147:5: note: remove the 'if' if its condition is always false
 if (state == NULL) {
 ^~~~~~~~~~~~~~~~~~~~
Python/Python-ast.c:1145:35: note: initialize the variable 'fields' to silence this warning
 PyObject *key, *value, *fields;
 ^
 = NULL
1 warning generated.
History
Date User Action Args
2020年07月03日 21:47:00blarsensetrecipients: + blarsen, vstinner
2020年07月03日 21:47:00blarsensetmessageid: <1593812820.7.0.967275410849.issue41204@roundup.psfhosted.org>
2020年07月03日 21:47:00blarsenlinkissue41204 messages
2020年07月03日 21:47:00blarsencreate

AltStyle によって変換されたページ (->オリジナル) /