On Wed, Oct 16, 2024 at 4:41 PM Bill Wendling <mo...@google.com> wrote: > > On Sun, Oct 6, 2024 at 8:56 PM Jan Hendrik Farr <ker...@jfarr.cc> wrote: > > > I want to separate several easily confused issues. Instead of just > > > saying __bdos, let's clearly refer to what calculation within bdos is > > > being used. There are 3 choices currently: > > > - alloc_size attribute > > > - counted_by attribute > > > - fallback to __bos (which is similar to sizeof(), except that FAMs are 0 > > > sized) > > > > > > Additionally there are (for all intents and purposes) 2 size > > > determinations to be made by __bos and __bdos, via argument 2: > > > - containing object size (type 0) ("maximum size") > > > - specific object size (type 1) ("minimum size") > > > > "maximum" vs "minimum" size would by type 0 vs type 2, but I think you > > do mean type 0 and type 1 as those are the types currently used by > > __struct_size and __member_size. Those are both "maximum" sizes. > > > > > > > > For example, consider: > > > > > > struct posix_acl *acl = malloc(1024); > > > acl->a_count = 1; > > > > > > what should these return: > > > > > > __bos(acl, 0) > > > __bos(acl, 1) > > > __bdos(acl, 0) > > > __bdos(acl, 1) > > > __bos(acl->a_entries, 0) > > > __bos(acl->a_entries, 1) > > > __bdos(acl->a_entries, 0) > > > __bdos(acl->a_entries, 1) > > > > > > Thank you for this detailed write-up! I'm sorry for my late response. > [snip] > > So in conclusion, if turning off the calculation for a pointer to the > whole struct works, then I'm okay with it. > Here's a potential fix:
https://github.com/llvm/llvm-project/pull/112636 -bw