diff options
author | Irit Katriel <1055913+iritkatriel@users.noreply.github.com> | 2024-10-04 16:37:38 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-10-04 16:37:38 (GMT) |
commit | f474391b26aa9208b44ca879f8635409d322f738 (patch) | |
tree | 0290f54d50ef8cb546cb4b6a7635a1294270551c /Python | |
parent | 994051e086b9ce624a3b16750d6f692bc4a3b07b (diff) | |
download | cpython-f474391b26aa9208b44ca879f8635409d322f738.zip cpython-f474391b26aa9208b44ca879f8635409d322f738.tar.gz cpython-f474391b26aa9208b44ca879f8635409d322f738.tar.bz2 |
gh-124871: fix 'visited' tracking in compiler's reachability analysis (#124952)
Diffstat (limited to 'Python')
-rw-r--r-- | Python/flowgraph.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/Python/flowgraph.c b/Python/flowgraph.c index 69d7e0a..3888629 100644 --- a/Python/flowgraph.c +++ b/Python/flowgraph.c @@ -1001,13 +1001,14 @@ remove_unreachable(basicblock *entryblock) { basicblock **sp = stack; entryblock->b_predecessors = 1; *sp++ = entryblock; + entryblock->b_visited = 1; while (sp > stack) { basicblock *b = *(--sp); - b->b_visited = 1; if (b->b_next && BB_HAS_FALLTHROUGH(b)) { if (!b->b_next->b_visited) { assert(b->b_next->b_predecessors == 0); *sp++ = b->b_next; + b->b_next->b_visited = 1; } b->b_next->b_predecessors++; } @@ -1017,8 +1018,8 @@ remove_unreachable(basicblock *entryblock) { if (is_jump(instr) || is_block_push(instr)) { target = instr->i_target; if (!target->b_visited) { - assert(target->b_predecessors == 0 || target == b->b_next); *sp++ = target; + target->b_visited = 1; } target->b_predecessors++; } |