[BPF] Diagnose unrepresentable BTF array bounds (#240545)
BTF encodes an array length as a 32-bit unsigned constant. Clang can
describe a variable-length array with a debug variable for the count.
Reading that count as an integer crashes the backend. A constant count
above UINT32_MAX is silently truncated.
Check each dimension before encoding it. After reporting an error,
register the array so enclosing types can finish resolving their
references. Keep the zero count used for flexible arrays and arrays with
no recorded dimensions.
Assisted-by: OpenAI Codex