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 November 23, 2022 18:41
@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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, Thanks for the kind explanation :)

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