[llvm] a3c715e - Twine - fix uninitialized variable warnings. NFCI.

David Blaikie via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 26 19:48:24 PDT 2020


Ping this still doesn't look like the best option (in that it suppresses
MSan's ability to diagnose truely uninitialized variable usage) - could you
please revert this and the other similar patches you've committed and/or
discuss alternative solutions that don't hinder MSan's ability to catch
more nuanced use-of-uninitialized?

On Tue, Nov 19, 2019 at 3:34 PM David Blaikie <dblaikie at gmail.com> wrote:

> Which compiler gave that warning and in what situation?
>
> In some cases it's advantageous to leave variables uninitialized if they
> aren't intended to be accessed before they're initialized by some other
> action - that way tools like MSan & static analysis can diagnose programmer
> errors where that initialization doesn't happen.
>
> On Mon, Nov 11, 2019 at 8:39 AM Simon Pilgrim via llvm-commits <
> llvm-commits at lists.llvm.org> wrote:
>
>>
>> Author: Simon Pilgrim
>> Date: 2019-11-10T11:21:43Z
>> New Revision: a3c715e9788d829031989b0a5ea4eb43c7288be9
>>
>> URL:
>> https://github.com/llvm/llvm-project/commit/a3c715e9788d829031989b0a5ea4eb43c7288be9
>> DIFF:
>> https://github.com/llvm/llvm-project/commit/a3c715e9788d829031989b0a5ea4eb43c7288be9.diff
>>
>> LOG: Twine - fix uninitialized variable warnings. NFCI.
>>
>> Added:
>>
>>
>> Modified:
>>     llvm/include/llvm/ADT/Twine.h
>>
>> Removed:
>>
>>
>>
>>
>> ################################################################################
>> diff  --git a/llvm/include/llvm/ADT/Twine.h
>> b/llvm/include/llvm/ADT/Twine.h
>> index 4140c22aad3d..2dc7486c924f 100644
>> --- a/llvm/include/llvm/ADT/Twine.h
>> +++ b/llvm/include/llvm/ADT/Twine.h
>> @@ -153,11 +153,11 @@ namespace llvm {
>>
>>      /// LHS - The prefix in the concatenation, which may be
>> uninitialized for
>>      /// Null or Empty kinds.
>> -    Child LHS;
>> +    Child LHS = {0};
>>
>>      /// RHS - The suffix in the concatenation, which may be
>> uninitialized for
>>      /// Null or Empty kinds.
>> -    Child RHS;
>> +    Child RHS = {0};
>>
>>      /// LHSKind - The NodeKind of the left hand side, \see getLHSKind().
>>      NodeKind LHSKind = EmptyKind;
>>
>>
>>
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at lists.llvm.org
>> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200326/05937911/attachment.html>


More information about the llvm-commits mailing list