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

qinzhao at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Fri Jun 10 20:24:48 GMT 2022


--- Comment #16 from qinzhao at gcc dot gnu.org ---
additional work are needed in order to make this task complete:

1. add one more new gcc option:


when it's on, only treat the following cases as flexing array:

trailing array with size 0;
trailing array with size 1;
trailing flexible array;

all other trailing arrays with size > 1 will be treated as normal arrays. 

2. there a lot of places in GCC that currently assume all trailing arrays as
flexible array, we might need to update all these places altogether to make GCC
behavior consistently. 

As I checked, most of the places used an old routine array_at_struct_end_p, we
might need to replace all the usage of "array_at_struct_end_p" with the new
option + the more strict checking on flexing trailing array. 

let me know if you have any comments and suggestions.

More information about the Gcc-bugs mailing list