msan uninitialized use diagnostic may be more useful to value variables, as
nullptr pointer access will core dump without msan. Initializing pointers
to nullptr is done everywhere in llvm and clang (search for '(nullptr)')
such as

DIBuilder::DIBuilder(Module &m, bool AllowUnresolvedNodes)
    : M(m), VMContext(M.getContext()), TempEnumTypes(nullptr),
      TempRetainTypes(nullptr), TempSubprograms(nullptr), TempGVs(nullptr),
      DeclareFn(nullptr), ValueFn(nullptr),
      AllowUnresolvedNodes(AllowUnresolvedNodes) {}

isn't init to nullptr the "right" thing to do?


2014-12-25 18:46 GMT+02:00 David Blaikie <[email protected]>:

> Any particular reason? It's sometimes handy to leave things uninitialized
> if they stents intended to be read until after some other write - in that
> way, msan can catch bugs when that constraint is violated.
> On Dec 25, 2014 3:41 AM, "Yaron Keren" <[email protected]> wrote:
>
>> Author: yrnkrn
>> Date: Thu Dec 25 05:38:15 2014
>> New Revision: 224835
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=224835&view=rev
>> Log:
>> Initialize CodeGeneratorImpl::Ctx in constructor.
>>
>>
>> Modified:
>>     cfe/trunk/lib/CodeGen/ModuleBuilder.cpp
>>
>> Modified: cfe/trunk/lib/CodeGen/ModuleBuilder.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/ModuleBuilder.cpp?rev=224835&r1=224834&r2=224835&view=diff
>>
>> ==============================================================================
>> --- cfe/trunk/lib/CodeGen/ModuleBuilder.cpp (original)
>> +++ cfe/trunk/lib/CodeGen/ModuleBuilder.cpp Thu Dec 25 05:38:15 2014
>> @@ -59,7 +59,7 @@ namespace {
>>      CodeGeneratorImpl(DiagnosticsEngine &diags, const std::string&
>> ModuleName,
>>                        const CodeGenOptions &CGO, llvm::LLVMContext& C,
>>                        CoverageSourceInfo *CoverageInfo = nullptr)
>> -      : Diags(diags), CodeGenOpts(CGO), HandlingTopLevelDecls(0),
>> +      : Diags(diags), Ctx(nullptr), CodeGenOpts(CGO),
>> HandlingTopLevelDecls(0),
>>          CoverageInfo(CoverageInfo),
>>          M(new llvm::Module(ModuleName, C)) {}
>>
>>
>>
>> _______________________________________________
>> cfe-commits mailing list
>> [email protected]
>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>>
>
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to