[PATCH] D110656: [clang][Sema] Warn on uninitialized array elments

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 30 10:38:48 PDT 2021


aaron.ballman added a comment.

In D110656#3034083 <https://reviews.llvm.org/D110656#3034083>, @xbolva00 wrote:

> Why just no special case "= {0};" pattern and do not warn in that case?

This was what I was thinking. I was basing that on the idea that `= { 0 }` to zero init the entire array is far more common than ` = { 1 }` to init the first element to one and the rest to zero (which is a case I think this diagnostic shines on because some users think that will fill all `1` instead of only the first element).

> If there are more patterns, take it from other side - pick patterns where you are sure that they are wrong and developer needs to fix them and emit warnings for them.

If there are other patterns, I'd love to know what they are.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D110656/new/

https://reviews.llvm.org/D110656



More information about the cfe-commits mailing list