w6c: keep nested unwrap destinations distinct

This commit is contained in:
2026-08-09 04:52:43 +09:00
parent 7ab080fe2a
commit a2faa8b071
3 changed files with 103 additions and 15 deletions

View File

@@ -8780,7 +8780,11 @@ fn cgassign(c: *cgen, n: *syntax.node) void = {
os.write(2, m16.ptr, m16.len: u64);
os.exit(1);
};
let dstscr: i32 = localadd(c, "@unwrapdst", 8, nil);
// Fresh per lowering: cgexpr(rhs) may recursively
// emit another #16 assignment while this address is
// live. Sharing one per-fn slot would let the inner
// assignment overwrite the outer receiver.
let dstscr: i32 = localalloc(c, "@unwrapdst", 8, nil);
emitline("\tMOVQ\tBX, ");
emitoff(dstscr: i64);
emitline("(BP)\n");