[Bug c/101836] __builtin_object_size(P->M, 1) where M is an array and the last member of a struct fails

2021-10-12 Thread msebor at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101836

Martin Sebor  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  ---
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.

[Bug c/101836] __builtin_object_size(P->M, 1) where M is an array and the last member of a struct fails

2021-08-09 Thread kees at outflux dot net via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101836

--- Comment #3 from Kees Cook  ---
Eww. That means _FORTIFY_SOURCE doesn't work correctly.

Can there please be a -fstrict-flex-arrays or something to turn off all the
heuristics so a code base can declare it only uses flex arrays for dynamic
trailing objects?

[Bug c/101836] __builtin_object_size(P->M, 1) where M is an array and the last member of a struct fails

2021-08-09 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101836

--- Comment #2 from Andrew Pinski  ---
See PR 44386.

[Bug c/101836] __builtin_object_size(P->M, 1) where M is an array and the last member of a struct fails

2021-08-09 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101836

--- Comment #1 from Andrew Pinski  ---
GCC treats all trailing arrays no matter what their size as flexible sized
arrays.  This is by design because of many code out there assumes that.