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

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 29 04:43:06 PDT 2021


aaron.ballman added a comment.

We typically do not introduce new off-by-default warnings into Clang because experience has shown that users typically do not enable them (so they tend not to be worth the maintenance burden). Instead, we try to make warnings that can be on-by-default with a very low false positive rate. Have you run over a large corpus of C and C++ code to see what false positives arise? Do you have ideas on what it would take to make this on by default? The one big one I can think of is that it's not at all uncommon in C to only initialize one element of the array to zero and rely on zero initialization of the rest (because an empty initializer list is technically not valid C code; it's a GNU extension we support): https://codesearch.isocpp.org/cgi-bin/cgi_ppsearch?q=%3D+%7B0%7D%3B&search=Search.


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