review(Driver.AbCip): fix declared UDT array members read as scalar (Medium)

Re-review at 7286d320. AbCip-016 (Medium): two cooperating defects made a declared array
member (e.g. REAL[4]) read one scalar/null — fan-out dropped ElementCount/IsArray, and
UdtMemberLayout.TryBuild ignored array members (mis-placing later members). Fix: thread
array shape through fan-out + opt whole-UDT grouping out when any member is an array + TDD.
AbCip-017 (severity-read StatusCode, Low) deferred.
This commit is contained in:
Joseph Doherty
2026-06-19 11:34:34 -04:00
parent db72dd1dca
commit a914b73d57
5 changed files with 181 additions and 4 deletions
@@ -44,6 +44,14 @@ public static class AbCipUdtMemberLayout
if (!TryGetSizeAlign(member.DataType, out var size, out var align))
return null;
// Driver.AbCip-016 — an array member can't be placed by declaration-only layout: the
// whole-UDT grouped read decodes one scalar per member at its offset and can't return
// an array, and advancing the cursor by the scalar size (not size * count) would
// mis-place every member after it. Opt the whole group out so array members fall back
// to the per-tag read path, which reads them as typed arrays.
if (member.IsArray || member.ElementCount > 1)
return null;
if (cursor % align != 0)
cursor += align - (cursor % align);