vdef: introduce v_counted_by_(field)
A new attribute can be used for flexible arrays to make the compiler smarter:
- https://clang.llvm.org/docs/AttributeReference.html#counted-by
- https://gcc.gnu.org/pipermail/gcc-patches/2023-August/628459.html
This would improve the array bound sanitizer.
Note: this has not been tested locally, but this should be safe until a compiler supports it. Once supported, we would detect and make the adjustments as needed.
I am generally 👍🏽 , this could potentially increase our code quality. BUT
this has not been tested locally
locally installing gcc-trunk and testing the changes should not be asking too much, rather than putting the burdon on a future incarnation of some other maintainer.
this has not been tested locally
locally installing gcc-trunk and testing the changes should not be asking too much, rather than putting the burdon on a future incarnation of some other maintainer.
I agree with the reasoning to test it before merge to not uncover work later on, I was partly thinking this could be easily tested in CCI. The attribute is maybe too new. Anyways, thanks, I will look into it.
@asadsa92 , do you need help with this?
@gquintard No, but thanks for the reminder. I have added this to my backlog, I will come to it soon.