[clang] [Clang][CodeGen] Emit load of GEP after EmitMemberExpr (PR #110487)
Jan Hendrik Farr via cfe-commits
cfe-commits at lists.llvm.org
Mon Sep 30 19:55:35 PDT 2024
Cydox wrote:
> I went ahead and used the `EmitPointerWithAlignment` for all (it worked without needing special casing). I'll look into doing this in Sema as a potential cleanup.
With that change now the compiler segfaults when compiling the example C file I posted above:
> ```c
> #include <stdio.h>
> #include <stdlib.h>
> #include <unistd.h>
>
> struct variable {
> int a;
> int b;
> int length;
> short array[] __attribute__((counted_by(length)));
> };
>
> struct bucket {
> int a;
> struct variable growable;
> // struct variable *growable;
> // int b;
> };
>
> int main(int argc, char *argv[])
> {
> struct bucket *p;
> struct variable *v;
>
> p = malloc(sizeof(*p) + sizeof(*p->growable.array) * 32);
> p->growable.length = 32;
>
>
> // printf("%zu\n", __builtin_dynamic_object_size(v->array, 1));
>
> // p->growable = v;
> printf("%zu\n", __builtin_dynamic_object_size(p->growable.array, 1));
>
> return 0;
> }
> ```
https://github.com/llvm/llvm-project/pull/110487
More information about the cfe-commits
mailing list