New submission from Gregory P. Smith <g...@krypto.org>:

Here's an example:

*** CID 1464688:  Control flow issues  (DEADCODE)
/Parser/parser.c: 24243 in _tmp_147_rule()
24237                 &&
24238                 (z = disjunction_rule(p))  // disjunction
24239             )
24240             {
24241                 D(fprintf(stderr, "%*c+ _tmp_147[%d-%d]: %s 
succeeded!\n", p->level, ' ', _mark, p->mark, "'if' disjunction"));
24242                 _res = z;
>>>     CID 1464688:  Control flow issues  (DEADCODE)
>>>     Execution cannot reach the expression "PyErr_Occurred()" inside this 
>>> statement: "if (_res == NULL && PyErr_O...".
24243                 if (_res == NULL && PyErr_Occurred()) {
24244                     p->error_indicator = 1;
24245                     D(p->level--);
24246                     return NULL;
24247                 }
24248                 goto done;


A lot of them are of that form, which seems harmless if they are true - it 
means a compiler may deduce the same thing and omit code generation for an 
impossible to trigger error block.  OTOH this could just be a weakness in the 
scanner.  (i don't know how to silence it via markers in the code, but i assume 
it is possible)

You'll need to login to Coverity to see the full report.   
https://scan.coverity.com/projects/python?tab=overview.
(it has been ages since i've logged in, they appear to support Github logins 
now.  yay.)

As the parser.c code is new for 3.9, I'm marking this as deferred blocker.  We 
should pay closer attention to the reports and update the parser generator code 
to generate code that passes analysis cleanly before we exit the beta phase.

----------
assignee: gvanrossum
messages: 371956
nosy: gregory.p.smith, gvanrossum, lys.nikolaou, p-ganssle
priority: deferred blocker
severity: normal
stage: needs patch
status: open
title: Large number of Coverity reports for parser.c
versions: Python 3.10, Python 3.9

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue41059>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to