FAILURE MAP
← Case archive

FA-43906 / Borrow checking / Open access

Raw-to-reference conversion postpones origin liveness until a later dereference · case 01

Raw-to-reference conversion postpones origin liveness until a later dereference.

Verified by executionVariant 1 · 21 checks per implementationDownload source bundle ↓JSON ↗

ROOT CAUSE

The static analyzer mishandles raw live origin: raw-to-reference conversion postpones origin liveness until a later dereference.

THE FAILURE

The static analyzer mishandles raw live origin: raw-to-reference conversion postpones origin liveness until a later dereference.

Unsuccessful approach: The partial repair uses if d['raw_reference'] and not d['origin_live'] and d['dereference']: errors.append('raw-live-origin'), which still violates the stipulated analysis contract.

Case contract

Check statically tracked reference provenance in a toy allocation IR. An address is not an allocation identity; allocation epoch must match; offset within object or one-past only for nondereferenced pointer; raw-to-reference conversion needs a live origin; integer roundtrip cannot invent provenance; reallocation invalidates old origins; zero-sized allocations still have separate ownership IDs; union reinterpretation needs a declared active variant; stack origins cannot become heap origins by cast; a subobject reference retains the base owner. Input is a fully explicit descriptor of the stated toy IR. Return rule identifiers in declaration order; absent optional obligations use the provided neutral defaults. No rule is an assertion about a production language.

Why this case matters

A finite offline static-analysis model of ownership and borrowing; it does not execute the analyzed program.

1 / The failure

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(d):
    errors=[]
    if d['address_equal'] and not d['allocation_equal'] and d['alias_inferred']: errors.append('address-not-owner')
    if d['epoch']!=d['current_epoch']: errors.append('epoch-validity')
    if d['offset']<0 or d['offset']>d['size'] or (d['dereference'] and d['offset']==d['size']): errors.append('one-past-dereference')
    if False: errors.append('raw-live-origin')
    if d['integer_only'] and d['provenance_granted']: errors.append('integer-provenance')
    if d['reallocated'] and d['old_origin_used']: errors.append('reallocation-invalidation')
    if not set(d['zero_size_owners'])<=set(d['merged_owners']): errors.append('zst-identity')
    if d['union_read'] and d['variant']!=d['active_variant']: errors.append('union-variant-witness')
    if d['stack_origin'] and d['heap_cast']: errors.append('storage-class-cast')
    if d['base_owner']!=d['subobject_owner']: errors.append('subobject-owner')
    return errors
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
base={'address_equal': False, 'allocation_equal': True, 'alias_inferred': False, 'epoch': 0, 'current_epoch': 0, 'offset': 0, 'size': 0, 'dereference': False, 'raw_reference': False, 'origin_live': True, 'integer_only': False, 'provenance_granted': False, 'reallocated': False, 'old_origin_used': False, 'zero_size_owners': [], 'merged_owners': [], 'variant': None, 'active_variant': None, 'union_read': False, 'stack_origin': False, 'heap_cast': False, 'base_owner': None, 'subobject_owner': None}
check('well formed empty obligations',solve(base),[])
check('address-not-owner regression 0', solve(dict(base, **({'address_equal':True,'allocation_equal':False,'alias_inferred':True,'size':N}))), ['address-not-owner'])
check('address-not-owner regression 1', solve(dict(base, **({'address_equal':True,'allocation_equal':False,'alias_inferred':True,'size':N+1}))), ['address-not-owner'])
check('epoch-validity regression 0', solve(dict(base, **({'epoch':N,'current_epoch':N+1}))), ['epoch-validity'])
check('epoch-validity regression 1', solve(dict(base, **({'epoch':N+1,'current_epoch':N+2}))), ['epoch-validity'])
check('one-past-dereference regression 0', solve(dict(base, **({'offset':N,'size':N,'dereference':True}))), ['one-past-dereference'])
check('one-past-dereference regression 1', solve(dict(base, **({'offset':N+1,'size':N+1,'dereference':True}))), ['one-past-dereference'])
check('raw-live-origin regression 0', solve(dict(base, **({'raw_reference':True,'origin_live':False}))), ['raw-live-origin'])
check('raw-live-origin regression 1', solve(dict(base, **({'raw_reference':True,'origin_live':False,'size':N}))), ['raw-live-origin'])
check('integer-provenance regression 0', solve(dict(base, **({'integer_only':True,'provenance_granted':True}))), ['integer-provenance'])
check('integer-provenance regression 1', solve(dict(base, **({'integer_only':True,'provenance_granted':True,'size':N}))), ['integer-provenance'])
check('reallocation-invalidation regression 0', solve(dict(base, **({'reallocated':True,'old_origin_used':True,'address_equal':True}))), ['reallocation-invalidation'])
check('reallocation-invalidation regression 1', solve(dict(base, **({'reallocated':True,'old_origin_used':True,'address_equal':True,'size':N}))), ['reallocation-invalidation'])
check('zst-identity regression 0', solve(dict(base, **({'zero_size_owners':['a','b'],'merged_owners':['a']}))), ['zst-identity'])
check('zst-identity regression 1', solve(dict(base, **({'zero_size_owners':[N,N+1],'merged_owners':[N]}))), ['zst-identity'])
check('union-variant-witness regression 0', solve(dict(base, **({'union_read':True,'variant':'b','active_variant':'a'}))), ['union-variant-witness'])
check('union-variant-witness regression 1', solve(dict(base, **({'union_read':True,'variant':N,'active_variant':N+1}))), ['union-variant-witness'])
check('storage-class-cast regression 0', solve(dict(base, **({'stack_origin':True,'heap_cast':True}))), ['storage-class-cast'])
check('storage-class-cast regression 1', solve(dict(base, **({'stack_origin':True,'heap_cast':True,'size':N}))), ['storage-class-cast'])
check('subobject-owner regression 0', solve(dict(base, **({'base_owner':'r','subobject_owner':'field'}))), ['subobject-owner'])
check('subobject-owner regression 1', solve(dict(base, **({'base_owner':N,'subobject_owner':N+1}))), ['subobject-owner'])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
Boundary fixtureActualExpectedOutcome
well formed empty obligations[][]Passed
address-not-owner regression 0['address-not-owner']['address-not-owner']Passed
address-not-owner regression 1['address-not-owner']['address-not-owner']Passed
epoch-validity regression 0['epoch-validity']['epoch-validity']Passed
epoch-validity regression 1['epoch-validity']['epoch-validity']Passed
one-past-dereference regression 0['one-past-dereference']['one-past-dereference']Passed
one-past-dereference regression 1['one-past-dereference']['one-past-dereference']Passed
raw-live-origin regression 0[]['raw-live-origin']Failed
raw-live-origin regression 1[]['raw-live-origin']Failed
integer-provenance regression 0['integer-provenance']['integer-provenance']Passed
integer-provenance regression 1['integer-provenance']['integer-provenance']Passed
reallocation-invalidation regression 0['reallocation-invalidation']['reallocation-invalidation']Passed
reallocation-invalidation regression 1['reallocation-invalidation']['reallocation-invalidation']Passed
zst-identity regression 0['zst-identity']['zst-identity']Passed
zst-identity regression 1['zst-identity']['zst-identity']Passed
union-variant-witness regression 0['union-variant-witness']['union-variant-witness']Passed
union-variant-witness regression 1['union-variant-witness']['union-variant-witness']Passed
storage-class-cast regression 0['storage-class-cast']['storage-class-cast']Passed
storage-class-cast regression 1['storage-class-cast']['storage-class-cast']Passed
subobject-owner regression 0['subobject-owner']['subobject-owner']Passed
subobject-owner regression 1['subobject-owner']['subobject-owner']Passed

SHA-256 / 34d44bca14830c749c61bc538057e5539202c6e1d4f28750bb2dd5b2752c2f20

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(d):
    errors=[]
    if d['address_equal'] and not d['allocation_equal'] and d['alias_inferred']: errors.append('address-not-owner')
    if d['epoch']!=d['current_epoch']: errors.append('epoch-validity')
    if d['offset']<0 or d['offset']>d['size'] or (d['dereference'] and d['offset']==d['size']): errors.append('one-past-dereference')
    if d['raw_reference'] and not d['origin_live'] and d['dereference']: errors.append('raw-live-origin')
    if d['integer_only'] and d['provenance_granted']: errors.append('integer-provenance')
    if d['reallocated'] and d['old_origin_used']: errors.append('reallocation-invalidation')
    if not set(d['zero_size_owners'])<=set(d['merged_owners']): errors.append('zst-identity')
    if d['union_read'] and d['variant']!=d['active_variant']: errors.append('union-variant-witness')
    if d['stack_origin'] and d['heap_cast']: errors.append('storage-class-cast')
    if d['base_owner']!=d['subobject_owner']: errors.append('subobject-owner')
    return errors
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
base={'address_equal': False, 'allocation_equal': True, 'alias_inferred': False, 'epoch': 0, 'current_epoch': 0, 'offset': 0, 'size': 0, 'dereference': False, 'raw_reference': False, 'origin_live': True, 'integer_only': False, 'provenance_granted': False, 'reallocated': False, 'old_origin_used': False, 'zero_size_owners': [], 'merged_owners': [], 'variant': None, 'active_variant': None, 'union_read': False, 'stack_origin': False, 'heap_cast': False, 'base_owner': None, 'subobject_owner': None}
check('well formed empty obligations',solve(base),[])
check('address-not-owner regression 0', solve(dict(base, **({'address_equal':True,'allocation_equal':False,'alias_inferred':True,'size':N}))), ['address-not-owner'])
check('address-not-owner regression 1', solve(dict(base, **({'address_equal':True,'allocation_equal':False,'alias_inferred':True,'size':N+1}))), ['address-not-owner'])
check('epoch-validity regression 0', solve(dict(base, **({'epoch':N,'current_epoch':N+1}))), ['epoch-validity'])
check('epoch-validity regression 1', solve(dict(base, **({'epoch':N+1,'current_epoch':N+2}))), ['epoch-validity'])
check('one-past-dereference regression 0', solve(dict(base, **({'offset':N,'size':N,'dereference':True}))), ['one-past-dereference'])
check('one-past-dereference regression 1', solve(dict(base, **({'offset':N+1,'size':N+1,'dereference':True}))), ['one-past-dereference'])
check('raw-live-origin regression 0', solve(dict(base, **({'raw_reference':True,'origin_live':False}))), ['raw-live-origin'])
check('raw-live-origin regression 1', solve(dict(base, **({'raw_reference':True,'origin_live':False,'size':N}))), ['raw-live-origin'])
check('integer-provenance regression 0', solve(dict(base, **({'integer_only':True,'provenance_granted':True}))), ['integer-provenance'])
check('integer-provenance regression 1', solve(dict(base, **({'integer_only':True,'provenance_granted':True,'size':N}))), ['integer-provenance'])
check('reallocation-invalidation regression 0', solve(dict(base, **({'reallocated':True,'old_origin_used':True,'address_equal':True}))), ['reallocation-invalidation'])
check('reallocation-invalidation regression 1', solve(dict(base, **({'reallocated':True,'old_origin_used':True,'address_equal':True,'size':N}))), ['reallocation-invalidation'])
check('zst-identity regression 0', solve(dict(base, **({'zero_size_owners':['a','b'],'merged_owners':['a']}))), ['zst-identity'])
check('zst-identity regression 1', solve(dict(base, **({'zero_size_owners':[N,N+1],'merged_owners':[N]}))), ['zst-identity'])
check('union-variant-witness regression 0', solve(dict(base, **({'union_read':True,'variant':'b','active_variant':'a'}))), ['union-variant-witness'])
check('union-variant-witness regression 1', solve(dict(base, **({'union_read':True,'variant':N,'active_variant':N+1}))), ['union-variant-witness'])
check('storage-class-cast regression 0', solve(dict(base, **({'stack_origin':True,'heap_cast':True}))), ['storage-class-cast'])
check('storage-class-cast regression 1', solve(dict(base, **({'stack_origin':True,'heap_cast':True,'size':N}))), ['storage-class-cast'])
check('subobject-owner regression 0', solve(dict(base, **({'base_owner':'r','subobject_owner':'field'}))), ['subobject-owner'])
check('subobject-owner regression 1', solve(dict(base, **({'base_owner':N,'subobject_owner':N+1}))), ['subobject-owner'])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
Boundary fixtureActualExpectedOutcome
well formed empty obligations[][]Passed
address-not-owner regression 0['address-not-owner']['address-not-owner']Passed
address-not-owner regression 1['address-not-owner']['address-not-owner']Passed
epoch-validity regression 0['epoch-validity']['epoch-validity']Passed
epoch-validity regression 1['epoch-validity']['epoch-validity']Passed
one-past-dereference regression 0['one-past-dereference']['one-past-dereference']Passed
one-past-dereference regression 1['one-past-dereference']['one-past-dereference']Passed
raw-live-origin regression 0[]['raw-live-origin']Failed
raw-live-origin regression 1[]['raw-live-origin']Failed
integer-provenance regression 0['integer-provenance']['integer-provenance']Passed
integer-provenance regression 1['integer-provenance']['integer-provenance']Passed
reallocation-invalidation regression 0['reallocation-invalidation']['reallocation-invalidation']Passed
reallocation-invalidation regression 1['reallocation-invalidation']['reallocation-invalidation']Passed
zst-identity regression 0['zst-identity']['zst-identity']Passed
zst-identity regression 1['zst-identity']['zst-identity']Passed
union-variant-witness regression 0['union-variant-witness']['union-variant-witness']Passed
union-variant-witness regression 1['union-variant-witness']['union-variant-witness']Passed
storage-class-cast regression 0['storage-class-cast']['storage-class-cast']Passed
storage-class-cast regression 1['storage-class-cast']['storage-class-cast']Passed
subobject-owner regression 0['subobject-owner']['subobject-owner']Passed
subobject-owner regression 1['subobject-owner']['subobject-owner']Passed

SHA-256 / 9c07877c53525e4eec47d4b8c328ee486041eec5597fb255d2412838f4a7e2c1

HELD IN THE MEMBER ARCHIVE

The verified repair and its recorded checks are member-only.

This mechanism has 21 recorded checks per implementation. The open-access tier publishes the failure and the unsuccessful fix; the repaired source that passes every check, and the observations that prove it, are available to members.

Every case sharing this mechanism uses the same contract and the same repair, so this one record is held back for all of them.

Member access is invitation-based. Sign in with your invited account to inspect the repair.

Sign in to the archive ↗

Verification & scope

The explicitly stated toy language is the complete scope; this is not a production compiler or a claim about Rust semantics. This reproducer isolates one failure mechanism. Results cover the supplied fixtures. Variants within a family share a test contract and should remain grouped when constructing evaluation splits. Related mechanisms with a shared evaluation_group must also remain together; these controlled models are not independent production incidents.

Observations recorded using Python 3.12.14 at 2026-09-29T14:44:07.133133+00:00.

Case digest / bbdd10ff2ad018a6c0be4dde2d4fcf1ce1964d0ee341b538fbba198d6dc88def