================
@@ -7195,6 +7195,12 @@ def note_counted_by_consider_using_sized_by : Note<
def warn_counted_by_attr_elt_type_unknown_size :
Warning<err_counted_by_attr_pointee_unknown_size.Summary>,
InGroup<BoundsSafetyCountedByEltTyUnknownSize>;
+def warn_counted_by_addrof_discards_count : Warning<
+ "taking the address of flexible array member %0 discards the "
+ "'%select{counted_by|sized_by|counted_by_or_null|sized_by_or_null}1' bound; "
+ "'__builtin_dynamic_object_size' on the resulting pointer uses the static "
+ "layout of the object, not the annotated count">,
+ InGroup<CountedByAddrof>, DefaultIgnore;
----------------
davidmenggx wrote:
The warning is now default on and fires only for
`__builtin_dynamic_object_size(&fam, 1)` where `fam` is a `__counted_by`
flexible array member reached through a pointer (not static/local/global
storage), rather than at every `&fam`
https://github.com/llvm/llvm-project/pull/206760
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits