efriedma-quic wrote:

The value clang computes is the difference between the address of the beginning 
of the struct, and the end of the array (or the end of the struct, if the array 
fits in the padding).  The value gcc computes is that, plus the offset between 
the beginning of the array and the end of the struct.  So the formula used by 
gcc is adding unused padding after the end of every flexible array.

My default stance would be that gcc and the Linux code in question are wrong. 
We could reconsider if strict checking is impractical for Linux, but I'd expect 
kernel devs to prefer catching accesses one past the end of the array.

https://github.com/llvm/llvm-project/pull/111015
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to