Commit 7c2f085
committed
test: add Bugs 23-24 discovered during broadcast stress testing
New bugs found by running 65 stress tests against the broadcast system
after Phase 3/4 fixes. All are pre-existing, not regressions.
Bug 23a — reshape col-broadcast wrong element order:
reshape(broadcast_to([[10],[20],[30]], (3,3)), (9,)) returns
[10,20,30,10,20,30,...] instead of [10,10,10,20,20,20,...].
_reshapeBroadcast uses offset % OriginalShape.size modular arithmetic
which walks original storage linearly instead of logical row-major.
Workaround: np.copy(a).reshape(...).
Bug 23b — np.abs on broadcast throws IncorrectShapeException:
Cast creates UnmanagedStorage with mismatched shape size (broadcast
size=6 vs storage size=0). The abs implementation doesn't handle
broadcast arrays that have storage smaller than the broadcast shape.
Bug 24 — transpose col-broadcast returns wrong values:
broadcast_to([[10],[20],[30]], (3,3)).T returns [[10,10,10],...×3]
instead of [[10,20,30],...×3]. Transpose materializes via Clone
and creates plain strides [3,1], losing the stride=0 broadcast
semantics. Should swap strides to [0,1] (zero-copy, like NumPy).
Row-broadcast .T works by coincidence.1 parent 527d9da commit 7c2f085
1 file changed
+1657
-0
lines changed
0 commit comments