Skip to content
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

gh-99708: fix bug where compiler crashes on if expression with an empty body block #99732

Merged
merged 1 commit into from Nov 24, 2022

Conversation

iritkatriel
Copy link
Member

@iritkatriel iritkatriel commented Nov 23, 2022

Fixes #99708.

The crash comes from a cleanup sequence where we call eliminate_empty_basic_blocks() followed by remove_redundant_nops(). Later we assert that there are no empty blocks, but removing a redundant NOP can create an empty basic block.

I don't think that removing empty blocks can create new redundant NOPs. So this PR reverses the order, and add a debug assertion afterwards that there are no redundant NOPs.

@iritkatriel iritkatriel requested a review from corona10 Nov 23, 2022
@iritkatriel iritkatriel requested a review from markshannon as a code owner Nov 23, 2022
@iritkatriel iritkatriel added interpreter-core (Objects, Python, Grammar, and Parser dirs) type-crash A hard crash of the interpreter, possibly with a core dump labels Nov 23, 2022
Copy link
Member

@corona10 corona10 left a comment

LGTM, Thanks for the kind explanation :)

@iritkatriel iritkatriel merged commit ae185fd into python:main Nov 24, 2022
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
interpreter-core (Objects, Python, Grammar, and Parser dirs) type-crash A hard crash of the interpreter, possibly with a core dump
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3.12: segmentation fault from compile() builtin
3 participants