[issue41204] Use of unitialized variable `fields` along error path in code generated from asdl_c.py

2020-08-10 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset d2bea2636d5f0c2b196966315790af8e79c7bf82 by Victor Stinner in 
branch '3.9':
[3.9] bpo-41194: Convert _ast extension to PEP 489 (GH-21807)
https://github.com/python/cpython/commit/d2bea2636d5f0c2b196966315790af8e79c7bf82


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41204] Use of unitialized variable `fields` along error path in code generated from asdl_c.py

2020-07-04 Thread STINNER Victor


STINNER Victor  added the comment:

Thanks for the report, it's not fixed.

--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41204] Use of unitialized variable `fields` along error path in code generated from asdl_c.py

2020-07-04 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 1f76453173267887ed05bb3783e862cb22365ae8 by Victor Stinner in 
branch 'master':
bpo-41204: Fix compiler warning in ast_type_init() (GH-21307)
https://github.com/python/cpython/commit/1f76453173267887ed05bb3783e862cb22365ae8


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41204] Use of unitialized variable `fields` along error path in code generated from asdl_c.py

2020-07-04 Thread Batuhan Taskaya


Change by Batuhan Taskaya :


--
nosy: +BTaskaya

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41204] Use of unitialized variable `fields` along error path in code generated from asdl_c.py

2020-07-03 Thread STINNER Victor


Change by STINNER Victor :


--
keywords: +patch
pull_requests: +20459
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/21307

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41204] Use of unitialized variable `fields` along error path in code generated from asdl_c.py

2020-07-03 Thread Brad Larsen


New submission from Brad Larsen :

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.

--
components: Interpreter Core
messages: 372963
nosy: blarsen, vstinner
priority: normal
severity: normal
status: open
title: Use of unitialized variable `fields` along error path in code generated 
from asdl_c.py
type: compile error
versions: Python 3.10

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com