[PATCH] D45532: [StaticAnalyzer] Checker to find uninitialized fields after a constructor call

Henry Wong via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 17 04:11:59 PDT 2018


MTC added a comment.

In https://reviews.llvm.org/D45532#1069683, @whisperity wrote:

> There is something that came up in my mind:
>
> Consider a construct like this:
>
>   class A
>   {
>     A()
>     {
>       memset(X, 0, 10 * sizeof(int));
>     }
>  
>     int X[10];
>   };
>
>
> I think it's worthy for a test case if this `X` is considered unitialised at the end of the constructor or not. (And if not, a ticket, or a fix for SA in a subpatch.)


Just for a reminding, there is a very primitive patch to model `memset()`, see D44934 <https://reviews.llvm.org/D44934>. And if we think that `memset` is a way of initialization, we may need to distinguish between POD objects and non-POD Objects.


https://reviews.llvm.org/D45532





More information about the cfe-commits mailing list