diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2016-10-25 09:30:43 +0300 |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2016-10-25 09:30:43 +0300 |
commit | cb908e42142f558092d2dfcb587106a1e65c5bb1 (patch) | |
tree | f2ade06d4d180799cb3f7db312e5f6f1cde2d6fd /Python/peephole.c | |
parent | 85d979bab0a8cf13f0915244db2b4b0b8aabca12 (diff) | |
download | cpython-cb908e42142f558092d2dfcb587106a1e65c5bb1.tar.gz |
Issue #28517: Fixed of-by-one error in the peephole optimizer that caused
keeping unreachable code.
Diffstat (limited to 'Python/peephole.c')
-rw-r--r-- | Python/peephole.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Python/peephole.c b/Python/peephole.c index 84eb2dbefd..dd8f3e4807 100644 --- a/Python/peephole.c +++ b/Python/peephole.c @@ -704,11 +704,11 @@ PyCode_Optimize(PyObject *code, PyObject* consts, PyObject *names, /* Remove unreachable ops after RETURN */ case RETURN_VALUE: h = i + 1; - while (h + 1 < codelen && ISBASICBLOCK(blocks, i, h + 1)) { + while (h < codelen && ISBASICBLOCK(blocks, i, h)) { h++; } if (h > i + 1) { - fill_nops(codestr, i + 1, h + 1); + fill_nops(codestr, i + 1, h); nexti = find_op(codestr, h); } break; |