diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2016-10-25 06:32:04 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2016-10-25 06:32:04 (GMT) |
commit | 42bcbf76f7a03610e610e48866e6fe85f403f0b9 (patch) | |
tree | e24db147015332dea9d641061f43441c363b3e0a /Python/peephole.c | |
parent | 0af16b4a5654d45a35fe8801c6595e0219fb2319 (diff) | |
parent | 7db3c488335168993689ddae5914a28e16188447 (diff) | |
download | cpython-42bcbf76f7a03610e610e48866e6fe85f403f0b9.zip cpython-42bcbf76f7a03610e610e48866e6fe85f403f0b9.tar.gz cpython-42bcbf76f7a03610e610e48866e6fe85f403f0b9.tar.bz2 |
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 84eb2db..dd8f3e4 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; |