Commit 678e990
committed
W22 cluster: fix 3 cond_branch Edge::set_to bypass sites in builder_emit_c.c
GDB investigation 2026-04-23 19:11Z + librarian 19:13:55Z pointed at
feedback_edge_management.md: terminator factories MUST use the C++
bridge (Edge::set_to manages BasicBlock::in_edges_) — direct .to writes
leave target blocks unaware of their predecessors and corrupt CFG-DFS.
Three production-path callers in builder_emit_c.c were using the BAD
pure-C cond_branch factory (hir_c_create_cond_branch) instead of the
required _cpp variant:
Line 4207 — hir_builder_emit_send_c (SEND bytecode)
Used in await/yield-from execution path. The done_block
after SEND's cond branch was orphaned in CFG, causing
hir_remove_unreachable_blocks_c to either crash on NULL
terminator (gen_chain test) or to walk into garbage
successors via stale .to pointers (await_caller test).
Line 4458 — emitMatchClass (attrs_tuple type-check branch)
Surfaced through earlier test runs.
Line 4522 — emitMatchMappingSequence (and_result branch)
Surfaced through earlier test runs.
The non-_cpp factory has an explicit "DO NOT USE for production"
warning at hir_instr_c.h:1170-1172 + 1184-1185. These three sites
slipped past audit during W27 emit-method conversion.
Verification at HEAD post-fix:
/tmp/test_await_autocompile.py: PASS — await_caller is_jit_compiled=
True, coro_returns_value is_jit_compiled=True (was: SIGSEGV at
iter 1000 in JIT compilation of asyncio internals)
test_phoenix_jit_autocompile.test_gen_chain: PASS (was: SIGSEGV in
hir_remove_unreachable_blocks_c NULL terminator)
/tmp/repro_min3.py yield-from: PASS (no regression)
Full test_phoenix_jit_{comparisons,controlflow,autocompile}: 368
tests PASS (no regressions; was 244 PASS pre-fix, +124 from
autocompile suite passing test_gen_chain)
W22 surface + 3 of 4 follow-on bugs (yield-from, controlflow,
comparisons, await deopt v27, await runtime, gen_chain) all FIXED via
3-commit cluster (66850a4 → f47bcc9 → 11db74f88c → THIS commit).
Refs: feedback_edge_management.md (Edge::set_to bridge requirement);
prior identical incident at 06e2ecb/7d0aff1e42 fixed by 61c319c
per librarian 19:13:55Z.1 parent f47bcc9 commit 678e990
1 file changed
Lines changed: 11 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4204 | 4204 | | |
4205 | 4205 | | |
4206 | 4206 | | |
4207 | | - | |
| 4207 | + | |
| 4208 | + | |
| 4209 | + | |
| 4210 | + | |
| 4211 | + | |
| 4212 | + | |
| 4213 | + | |
4208 | 4214 | | |
4209 | 4215 | | |
4210 | 4216 | | |
| |||
4455 | 4461 | | |
4456 | 4462 | | |
4457 | 4463 | | |
4458 | | - | |
| 4464 | + | |
| 4465 | + | |
4459 | 4466 | | |
4460 | 4467 | | |
4461 | 4468 | | |
| |||
4519 | 4526 | | |
4520 | 4527 | | |
4521 | 4528 | | |
4522 | | - | |
| 4529 | + | |
| 4530 | + | |
4523 | 4531 | | |
4524 | 4532 | | |
4525 | 4533 | | |
| |||
0 commit comments