[clang] [CodeGen] Revamp counted_by calculations (PR #70606)

Bill Wendling via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 1 16:41:15 PDT 2023


bwendling wrote:

@kees, @nickdesaulniers, @rapidsna, and @apple-fcloutier Should this feature support a `__bdos` to an address inside the FAM?

```
#include <stdio.h>
#include <stdlib.h>

struct flex {
        double dummy;
        char count;
        char fam[] __attribute__((counted_by(count)));
};

int main() {
        struct flex *f = malloc(sizeof(struct flex) + 42 * sizeof(char));

        f->count = 42;
        printf("__bdos(&f->fam[3], 1) == %lu\n", __builtin_dynamic_object_size(&f->fam[3], 1));
        return 0;
}
```

https://github.com/llvm/llvm-project/pull/70606


More information about the cfe-commits mailing list