You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: Correct segment splitting for single-block async functions with await
The split_single_block function was incorrectly assigning the original
Return terminator to ALL segments. This caused segment_await_map in
build_states to fail to identify await segments (it looks for Branch
terminators), resulting in:
- Await states being treated as Return states
- Return value computation included in wrong state
- Cranelift panic with invalid value reference (v4294967295)
The fix ensures:
- Segments BEFORE an await get a Branch terminator (signaling await point)
- Only the FINAL segment gets the original Return terminator
Test results:
- add_to_sum(50) = 1375 ✓ (sum(1..50) + 100 = 1275 + 100)
- add_to_sum(10) = 155 ✓ (sum(1..10) + 100 = 55 + 100)
- All 104 embed tests pass
- All 41 async tests pass
0 commit comments