On 2/2/23 10:05, Kees Cook via Gcc-patches wrote:
Right -- this can lead (at least) to type confusion and other problems
too. We've been trying to remove all of these overlaps in the Linux
kernel. I mention it the "Overlapping composite structure members"
section at https://people.kernel.org/kees/bounded-flexible-arrays-in-c
Good. We found several of these when Martin S was doing his work on the
diagnostics a few years back. It wasn't hard to see what the intent
was, but it struck me as a poor (ab)use of the feature and that I
wouldn't be surprised if compilers might differ in their semantics
around this stuff.
jeff