[clang] [clang] Automatic initialization for small struct fields (PR #229584)

Justin Stitt via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 21 11:54:59 PDT 2026


JustinStitt wrote:

how does this all work with `-ftrivial-auto-var-init-stop-after=N`?

```c
struct S { int a, b, c, d; char buf[2000]; };
void f(void) { struct S s; int x; use(&s); use(&x); }
```

before this pr `-ftrivial-auto-var-init-stop-after=2` would mean we initialize `s` and `x`. after this pr, `s` uses slot 1, `s.a` slot 2 and `s.{b,c,d,buf}` and `x` are left uninitialized. is this an intentional change?

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


More information about the cfe-commits mailing list