[Bug middle-end/77301] __builtin_object_size incorrect for an array in a struct referenced by a pointer
jakub at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Fri Aug 19 17:42:00 GMT 2016
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77301
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
CC| |jakub at gcc dot gnu.org
Resolution|--- |INVALID
--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
The result looks good, the expectations are wrong.
If the least significant bit is clear (i.e. bos0 and bos2), then objects are
whole variables, otherwise (bos1/bos3) we take possible subobjects into
account.
bos0 is the size of the whole object, ignoring any subobject boundaries, so it
must be 8. The subobject size is 4, so that you get for bos1. bos2 and bos3
are the minimas, but on the first line you know the sizes exactly, so bos0 ==
bos2 and bos1 == bos3.
For the second line, you don't know how big the object is, so -1 is the maximum
and 0 is minimum for the whole object. For the subobject, it isn't a flexible
array member or something like that, so in a valid program the subobject length
must be exactly 4.
More information about the Gcc-bugs
mailing list