> On Aug 10, 2023, at 12:39 PM, Jakub Jelinek <ja...@redhat.com> wrote: > > On Thu, Aug 10, 2023 at 12:30:06PM -0400, Siddhesh Poyarekar wrote: >> The definition of __bos/__bdos allows us the freedom to *estimate* rather >> than be precise, so I'd go for sizeof(x) + N * sizeof(*x.a) since it's bound >> to give the more conservative answer of the two. > > To be precise, we have the 0/1 modes vs. 2/3. So, when not determining > __bos/__bdos from actual allocation size or size of an stack object or > size of data section object but something else (say counted_by), perhaps > 0/1 modes should give the upper estimate of sizeof (x) + N * sizeof(elt) > and 2/3 modes should give a lower estimate, so offsetof + N * sizeof(elt), > then user code can continue testing if both modes are equal to have > exact number. Yes, this sounds reasonable to me. Qing > > Jakub >
- Re: [V2][PATCH 0/3... Martin Uecker
- Re: [V2][PATCH 0/3... Jakub Jelinek via Gcc-patches
- Re: [V2][PATCH 0/3... Martin Uecker
- Re: [V2][PATCH 0/3... Siddhesh Poyarekar
- Re: [V2][PATCH 0/3... Martin Uecker
- Re: [V2][PATCH 0/3... Qing Zhao via Gcc-patches
- Re: [V2][PATCH 0/3... Siddhesh Poyarekar
- Re: [V2][PATCH 0/3... Jakub Jelinek via Gcc-patches
- Re: [V2][PATCH 0/3... Siddhesh Poyarekar
- Re: [V2][PATCH 0/3... Qing Zhao via Gcc-patches
- Re: [V2][PATCH 0/3... Qing Zhao via Gcc-patches
- Re: [V2][PATCH 0/3... Michael Matz via Gcc-patches
- Re: [V2][PATCH 0/3] Ne... Michael Matz via Gcc-patches
- Re: [V2][PATCH 0/3] New attribute &... Qing Zhao via Gcc-patches
- Re: [V2][PATCH 0/3] New attribute "coun... Kees Cook via Gcc-patches
- Re: [V2][PATCH 0/3] New attribute "... Kees Cook via Gcc-patches
- Re: [V2][PATCH 0/3] New attribute &... Qing Zhao via Gcc-patches
- Re: [V2][PATCH 0/3] New attribu... Kees Cook via Gcc-patches