FAILURE MAP
← Case archive

FA-246 / Runtime and resources / Open access

An arena aligns block size instead of its starting address · case 01

An allocation starts at a misaligned cursor even though its padded size is a multiple of alignment.

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

ROOT CAUSE

Padding is applied to the length rather than to the current address before reservation.

VERIFIED REPAIR

Round the current cursor up to the next permitted aligned address, using that address unchanged when already aligned.

Unsuccessful approach: Always moving to the following alignment boundary wastes a full alignment unit on already aligned addresses.

Case contract

Cursor and sizes are nonnegative integers; each requested alignment is a positive integer, not necessarily a power of two. Return [starting addresses,final cursor]. Each start is the least aligned address >= cursor, then cursor becomes start+size. Zero-size reservations may consume alignment padding.

Why this case matters

Models address arithmetic in an arena allocator without dereferencing memory, and exposes both misalignment and unnecessary padding independent of machine word size.

1 / The failure

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

N = 1
observations = []
def solve(cursor, requests):
    starts = []
    for size, alignment in requests:
        starts.append(cursor)
        cursor += ((size+alignment-1)//alignment)*alignment
    return [starts, cursor]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('unaligned starting cursor', solve(8*N+1, [[N, 8]]), [[8*N+8], 9*N+8])
check('already aligned cursor', solve(8*N, [[N, 8]]), [[8*N], 9*N])
check('non-power-of-two alignment', solve(3*N+1, [[N, 3]]), [[3*N+3], 4*N+3])
check('consecutive different alignments', solve(0, [[N, 1], [N, 8]]), [[0, 8], 8+N])
check('zero-size aligned reservation', solve(8*N, [[0, 8]]), [[8*N], 8*N])
check('no allocation requests', solve(N, []), [[], N])
check('unit alignment adds no padding', solve(N, [[N, 1]]), [[N], 2*N])
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
unaligned starting cursor[[9], 17][[16], 17]Failed
already aligned cursor[[8], 16][[8], 9]Failed
non-power-of-two alignment[[4], 7][[6], 7]Failed
consecutive different alignments[[0, 1], 9][[0, 8], 9]Failed
zero-size aligned reservation[[8], 8][[8], 8]Passed
no allocation requests[[], 1][[], 1]Passed
unit alignment adds no padding[[1], 2][[1], 2]Passed

SHA-256 / 035ce5a00248a87cea45b4678bc3aae6d6847daf15362d3afffbaee5dc10b2bc

2 / The unsuccessful fix

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

N = 1
observations = []
def solve(cursor, requests):
    starts = []
    for size, alignment in requests:
        start = (cursor//alignment+1)*alignment
        starts.append(start)
        cursor = start+size
    return [starts, cursor]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('unaligned starting cursor', solve(8*N+1, [[N, 8]]), [[8*N+8], 9*N+8])
check('already aligned cursor', solve(8*N, [[N, 8]]), [[8*N], 9*N])
check('non-power-of-two alignment', solve(3*N+1, [[N, 3]]), [[3*N+3], 4*N+3])
check('consecutive different alignments', solve(0, [[N, 1], [N, 8]]), [[0, 8], 8+N])
check('zero-size aligned reservation', solve(8*N, [[0, 8]]), [[8*N], 8*N])
check('no allocation requests', solve(N, []), [[], N])
check('unit alignment adds no padding', solve(N, [[N, 1]]), [[N], 2*N])
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
unaligned starting cursor[[16], 17][[16], 17]Passed
already aligned cursor[[16], 17][[8], 9]Failed
non-power-of-two alignment[[6], 7][[6], 7]Passed
consecutive different alignments[[1, 8], 9][[0, 8], 9]Failed
zero-size aligned reservation[[16], 16][[8], 8]Failed
no allocation requests[[], 1][[], 1]Passed
unit alignment adds no padding[[2], 3][[1], 2]Failed

SHA-256 / bcbc5958cde6bf9ad8272a02f124d5de04295251b5e1196d03978ca930ebe433

3 / The verified repair

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

N = 1
observations = []
def solve(cursor, requests):
    starts = []
    for size, alignment in requests:
        start = ((cursor+alignment-1)//alignment)*alignment
        starts.append(start)
        cursor = start+size
    return [starts, cursor]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('unaligned starting cursor', solve(8*N+1, [[N, 8]]), [[8*N+8], 9*N+8])
check('already aligned cursor', solve(8*N, [[N, 8]]), [[8*N], 9*N])
check('non-power-of-two alignment', solve(3*N+1, [[N, 3]]), [[3*N+3], 4*N+3])
check('consecutive different alignments', solve(0, [[N, 1], [N, 8]]), [[0, 8], 8+N])
check('zero-size aligned reservation', solve(8*N, [[0, 8]]), [[8*N], 8*N])
check('no allocation requests', solve(N, []), [[], N])
check('unit alignment adds no padding', solve(N, [[N, 1]]), [[N], 2*N])
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
unaligned starting cursor[[16], 17][[16], 17]Passed
already aligned cursor[[8], 9][[8], 9]Passed
non-power-of-two alignment[[6], 7][[6], 7]Passed
consecutive different alignments[[0, 8], 9][[0, 8], 9]Passed
zero-size aligned reservation[[8], 8][[8], 8]Passed
no allocation requests[[], 1][[], 1]Passed
unit alignment adds no padding[[1], 2][[1], 2]Passed

SHA-256 / c5391f1ab83111346479c656511a20704acd1e7c8d3e973faa072f4c238db0fc

Verification & scope

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:36:51.534948+00:00.

Case digest / b3c1c8339f5944f1aeb5d1073935bbf9b51912d84409cb5adee0d4383dfbb4e6