[all-commits] [llvm/llvm-project] 882457: [Clang] Fix 'counted_by' for nested struct pointer...
Jan Hendrik Farr via All-commits
all-commits at lists.llvm.org
Wed Oct 2 22:16:42 PDT 2024
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 882457a2eedbe6d53161b2f78fcf769fc9a93e8a
https://github.com/llvm/llvm-project/commit/882457a2eedbe6d53161b2f78fcf769fc9a93e8a
Author: Jan Hendrik Farr <Cydox at users.noreply.github.com>
Date: 2024-10-03 (Thu, 03 Oct 2024)
Changed paths:
M clang/lib/CodeGen/CGExpr.cpp
A clang/test/CodeGen/attr-counted-by-pr110385.c
M clang/test/CodeGen/attr-counted-by.c
Log Message:
-----------
[Clang] Fix 'counted_by' for nested struct pointers (#110497)
Fix counted_by attribute for cases where the flexible array member is
accessed through struct pointer inside another struct:
```
struct variable {
int a;
int b;
int length;
short array[] __attribute__((counted_by(length)));
};
struct bucket {
int a;
struct variable *growable;
int b;
};
```
__builtin_dynamic_object_size(p->growable->array, 0);
This commit makes sure that if the StructBase is both a MemberExpr and a
pointer, it is treated as a pointer. Otherwise clang will generate to
code to access the address of p->growable intead of loading the value of
p->growable->length.
Fixes #110385
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