New submission from Brandt Bucher <[email protected]>:
The following code hangs during compilation on 3.11 and 3.10:
>>> while True or spam: pass
Our peepholer gets stuck in a loop, repeatedly "optimizing" instruction 4
(POP_JUMP_IF_TRUE -> JUMP_ABSOLUTE):
1 0 JUMP_ABSOLUTE 0 (to 0)
2 LOAD_NAME 0 (spam)
4 POP_JUMP_IF_TRUE 0 (to 0)
After optimizing jumps to jumps like these, we always back up and attempt to
optimize the same instruction again (which makes it possible to optimize three
or more chained jumps on the same line). The issue is that this particular
optimization doesn't actually change the instruction, since both jumps target
the same exact block. Since nothing changes, we loop forever.
The fix is really simple: just skip the optimization if instr->i_target ==
target->i_target. We already do this for several other types of jumps; it just
looks like POP_JUMP_IF_TRUE and POP_JUMP_IF_FALSE might have been missed.
I'll have a PR up soon.
----------
assignee: brandtbucher
components: Interpreter Core
messages: 406046
nosy: Mark.Shannon, brandtbucher
priority: high
severity: normal
status: open
title: Compiler hangs during jump elimination
type: crash
versions: Python 3.11
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue45773>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com