-
-
Notifications
You must be signed in to change notification settings - Fork 31.9k
basicblock_addop Assertion #109627
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Confirmed on main, 3.11 is fine. cc @iritkatriel for I'll try to bisect but not sure I'll have time to finish the bisect. |
I'm looking. I don't think bisecting will help - the jump targets labels are new so you'll probably get to the large PR that added them. |
In order to ensure that function exits have a line number, the compiler duplicates small exit blocks which (1) do not have a line number in any instruction and (2) have more than one predecessor. Since these blocks are jump targets (at least one predecessor reaches this block via a jump or exception), they need to have labels assigned to them. This was missing, and is added in the attached PR. This begs the question "how did this ever work?" The assertion that fails here is in a piece of code that transforms a conditional backwards jump into a conditional forward jump followed by an unconditional backward jump (because all backward jumps are unconditional). It is this code that asserted the label. In general the labels are not that useful this late in the compiler's process, they are mostly used in the code generation phase, before we have the CFG with a direct pointer from a jump to its target block. The typical case of a small basic block is the "return None" of a function, and it is not a target of a conditional backward branch - this is what made this edge case rare. |
@15r10nk - Thank you for finding this and for the tiny repro. |
…mp target labels (python#109630) (cherry picked from commit 9ccf054)
…mp target labels (python#109630) (cherry picked from commit 9ccf054)
@iritkatriel thank you for fixing this bug. |
Bug report
Bug description:
I found the following error with the latest cpython 3.12 from git (4a0c118), which I build myself with --with-pydebug enabled.
source:
output (Python 3.12.0rc3+):
CPython versions tested on:
3.12
Operating systems tested on:
Linux
Linked PRs
The text was updated successfully, but these errors were encountered: