[Bug c/101836] __builtin_object_size(P->M, 1) where M is an array and the last member of a struct fails
msebor at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Wed Oct 13 02:11:00 GMT 2021
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101836
Martin Sebor <msebor at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed| |2021-10-13
Ever confirmed|0 |1
Status|UNCONFIRMED |NEW
CC| |msebor at gcc dot gnu.org,
| |siddhesh at redhat dot com
--- Comment #4 from Martin Sebor <msebor at gcc dot gnu.org> ---
I'm not sure how feasible it is to change __builtin_object_size or to add an
option to control this behavior but I agree that treating all trailing arrays
as flexible array members is overly permissive and unhelpful (GCC warnings like
-Warray-bounds are stricter and treat only zero and one-element arrays that
way). Let me confirm this request and CC Siddhesh who just submitted a patch
for __builtin_dynamic_object_size. Maybe that's a way toward something
stricter.
More information about the Gcc-bugs
mailing list