>>> If we turned on -fstrict-flex-arrays=3, these would become undefined
>>> behavior and trigger the ubsan sanitizer.
>>
>> The compiler setting can be changed on a per-struct basis via
>>
>> __attribute__((strict_flex_arrays(N)));
>
> This only works with gcc, not clang, so it's not a viable solution.
clang has support for it starting with version 16.0, see [1]. Is that
clang version too recent to require it?
--
David Geier
[1] https://releases.llvm.org/16.0.0/tools/clang/docs/ReleaseNotes.html