[all-commits] [llvm/llvm-project] 108ab4: [Clang] Disable use of the counted_by attribute fo...
Bill Wendling via All-commits
all-commits at lists.llvm.org
Tue Oct 29 02:01:13 PDT 2024
Branch: refs/heads/release/19.x
Home: https://github.com/llvm/llvm-project
Commit: 108ab46cf57d769795c8310cebcf73e3a0c189ad
https://github.com/llvm/llvm-project/commit/108ab46cf57d769795c8310cebcf73e3a0c189ad
Author: Bill Wendling <morbo at google.com>
Date: 2024-10-29 (Tue, 29 Oct 2024)
Changed paths:
M clang/lib/CodeGen/CGBuiltin.cpp
M clang/test/CodeGen/attr-counted-by.c
Log Message:
-----------
[Clang] Disable use of the counted_by attribute for whole struct pointers (#112636)
The whole struct is specificed in the __bdos. The calculation of the
whole size of the structure can be done in two ways:
1) sizeof(struct S) + count * sizeof(typeof(fam))
2) offsetof(struct S, fam) + count * sizeof(typeof(fam))
The first will add any remaining whitespace that might exist after
allocation while the second method is more precise, but not quite
expected from programmers. See [1] for a discussion of the topic.
GCC isn't (currently) able to calculate __bdos on a pointer to the whole
structure. Therefore, because of the above issue, we'll choose to match
what GCC does for consistency's sake.
[1] https://lore.kernel.org/lkml/ZvV6X5FPBBW7CO1f@archlinux/
Co-authored-by: Eli Friedman <efriedma at quicinc.com>
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list