Issue 151240
Summary `__builtin_dynamic_object_size` does not report size of function argument VLAs
Labels new issue
Assignees
Reporter kees
    For function argument VLAs, GCC correctly reports the expected size. Clang seems unaware:

```
#include <stdio.h>

void __attribute__((noinline))
foo(int n, short array[n])
{
 printf("%zu\n", __builtin_dynamic_object_size(array, 1));
}

int main(void)
{
        short array[10];

        foo(10, array);
 return 0;
}
```


```
$ gcc -Wall -O2 -o fvla-gcc fvla.c && ./fvla-gcc
20
$ clang -Wall -O2 -o fvla-clang fvla.c && ./fvla-clang
18446744073709551615
```

@bwendling 
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to