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
{{ message }}
Repository navigation
A foreach value over an untyped element, narrowed by instanceof then rebound to an object in else, fails MIR.verify ownflow (obj vs mixdead) #160
compile failed (rc=65):
compile failed: MIR.verify: ownflow: $adapter read at line 16 in f past a representation mismatch (obj vs mixdead): the name is live there
compile: front-end (parse/typeck/IR) returned null (rc=65)
Tracking
Known-bug repro: tests/aot/repro/crash/foreach_erased_value_narrowed_then_rebound_ownflow.php — bash tests/aot/xfail.sh -k foreach_erased_value_narrowed_then_rebound_ownflow reports XFAIL while this is open and XPASS once it is fixed; then move the repro into tests/aot/cases/ and close this issue.
Diagnosis (from MANTICORE_OWN_TRACE on symfony CachePoolPass::process, where this blocks building a symfony app):
the foreach value var over an erased element is bound Scalar (OwnershipFlow::bindBorrow, no flavor key for unknown);
instanceof CD narrows it to obj<CD> in the then-arm, so InferTypes::planMergeShadow sees obj vs obj and plants no box-back;
the else-arm stores a fresh Own(obj); OwnLattice::meet(Own, Scalar) -> MixDead, and the read after the loop is a deadRead.
Binding the element as Borrow(<name's obj key>) would let the existing Borrow/Own join (own_retain on the borrowed edge) settle it, but retains an erased word as an object, which is only safe where the word passed the instanceof. Needs a decision, not a blind patch.
Tried binding the erased element as Borrow(obj) when every other store of the name is an object. Unsound: the repro then compiles but dies at run time (SIGUSR1) — the join's own_retain runs on a non-object word (null from an object's property). The fix has to be at the type level instead: the instanceof narrowing hides the unknown-vs-obj disagreement from InferTypes::planMergeShadow, so no box-back is planted.
Type-level attempt: planting the box-back against the pre-narrowing slot type (so the instanceof-narrowed then-arm no longer hides unknown/cell vs obj) is not enough — the plant is dropped again on a later InferTypes run and the final MIR has no box-back. The real value at the foreach (symfony: elements of an erased array) is a decoded cell, the else-arm stores a raw obj pointer: two representations in one slot, which is a miscompile risk beyond the verifier message. Needs a look at loopMerge / unplantAgreedBoxBacks together with the instanceof narrowing.
Activity
blacktrs commentedon Oct 9, 2026
Diagnosis (from MANTICORE_OWN_TRACE on symfony
CachePoolPass::process, where this blocks building a symfony app):Scalar(OwnershipFlow::bindBorrow, no flavor key forunknown);instanceof CDnarrows it toobj<CD>in the then-arm, soInferTypes::planMergeShadowsees obj vs obj and plants no box-back;Own(obj);OwnLattice::meet(Own, Scalar)-> MixDead, and the read after the loop is a deadRead.Binding the element as
Borrow(<name's obj key>)would let the existing Borrow/Own join (own_retain on the borrowed edge) settle it, but retains an erased word as an object, which is only safe where the word passed the instanceof. Needs a decision, not a blind patch.blacktrs commentedon Oct 9, 2026
Tried binding the erased element as Borrow(obj) when every other store of the name is an object. Unsound: the repro then compiles but dies at run time (SIGUSR1) — the join's own_retain runs on a non-object word (null from an object's property). The fix has to be at the type level instead: the instanceof narrowing hides the unknown-vs-obj disagreement from InferTypes::planMergeShadow, so no box-back is planted.
blacktrs commentedon Oct 9, 2026
Type-level attempt: planting the box-back against the pre-narrowing slot type (so the instanceof-narrowed then-arm no longer hides unknown/cell vs obj) is not enough — the plant is dropped again on a later InferTypes run and the final MIR has no box-back. The real value at the foreach (symfony: elements of an erased array) is a decoded cell, the else-arm stores a raw obj pointer: two representations in one slot, which is a miscompile risk beyond the verifier message. Needs a look at loopMerge / unplantAgreedBoxBacks together with the instanceof narrowing.