<div dir="ltr">Honestly this isn't really my area - was just throwing the question out there for you/others who might own/care about this code to see if this was the right direction.<br><br>Not sure what these error paths actually represent (are these the failure cases one would hit if one simply truncated a bitcode file? If so, we could actually have test coverage for that easily enough)? Or are there other checks that catch that earlier?</div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Dec 12, 2014 at 11:15 AM, Yaron Keren <span dir="ltr"><<a href="mailto:yaron.keren@gmail.com" target="_blank">yaron.keren@gmail.com</a>></span> wrote:<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="rtl"><div dir="ltr">I have propagated the error codes into ChildTarget.cpp. </div><div dir="ltr">What do you think of the attached patch?<br></div><div dir="ltr"><br></div><div dir="ltr"><br></div><div dir="ltr"><br></div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><div dir="ltr"><br><div class="gmail_quote">2014-12-12 19:56 GMT+02:00 David Blaikie <span dir="ltr"><<a href="mailto:dblaikie@gmail.com" target="_blank">dblaikie@gmail.com</a>></span>:<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br><div class="gmail_extra"><br><div class="gmail_quote"><span>On Fri, Dec 12, 2014 at 3:07 AM, Yaron Keren <span dir="ltr"><<a href="mailto:yaron.keren@gmail.com" target="_blank">yaron.keren@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: yrnkrn<br>
Date: Fri Dec 12 05:07:51 2014<br>
New Revision: 224114<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=224114&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=224114&view=rev</a><br>
Log:<br>
Silence gcc 4.9.1 warning 'xyz' is used uninitialized in this function.<br>
<br>
In release builds this is actually possible as without asserts there is<br>
no testing of the actual read bytes and the variables could be partially<br>
uninitialized.<br></blockquote><div><br></div></span><div>Should we instead be actually testing the number of bytes read in a non-asserts build?</div><div><div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
<br>
Modified:<br>
    llvm/trunk/tools/lli/ChildTarget/ChildTarget.cpp<br>
<br>
Modified: llvm/trunk/tools/lli/ChildTarget/ChildTarget.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/lli/ChildTarget/ChildTarget.cpp?rev=224114&r1=224113&r2=224114&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/lli/ChildTarget/ChildTarget.cpp?rev=224114&r1=224113&r2=224114&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/tools/lli/ChildTarget/ChildTarget.cpp (original)<br>
+++ llvm/trunk/tools/lli/ChildTarget/ChildTarget.cpp Fri Dec 12 05:07:51 2014<br>
@@ -97,15 +97,15 @@ void LLIChildTarget::handleMessage(LLIMe<br>
 // Incoming message handlers<br>
 void LLIChildTarget::handleAllocateSpace() {<br>
   // Read and verify the message data size.<br>
-  uint32_t DataSize;<br>
+  uint32_t DataSize = 0;<br>
   int rc = ReadBytes(&DataSize, 4);<br>
   (void)rc;<br>
   assert(rc == 4);<br>
   assert(DataSize == 8);<br>
<br>
   // Read the message arguments.<br>
-  uint32_t Alignment;<br>
-  uint32_t AllocSize;<br>
+  uint32_t Alignment = 0;<br>
+  uint32_t AllocSize = 0;<br>
   rc = ReadBytes(&Alignment, 4);<br>
   assert(rc == 4);<br>
   rc = ReadBytes(&AllocSize, 4);<br>
@@ -121,13 +121,13 @@ void LLIChildTarget::handleAllocateSpace<br>
<br>
 void LLIChildTarget::handleLoadSection(bool IsCode) {<br>
   // Read the message data size.<br>
-  uint32_t DataSize;<br>
+  uint32_t DataSize = 0;<br>
   int rc = ReadBytes(&DataSize, 4);<br>
   (void)rc;<br>
   assert(rc == 4);<br>
<br>
   // Read the target load address.<br>
-  uint64_t Addr;<br>
+  uint64_t Addr = 0;<br>
   rc = ReadBytes(&Addr, 8);<br>
   assert(rc == 8);<br>
   size_t BufferSize = DataSize - 8;<br>
@@ -150,14 +150,14 @@ void LLIChildTarget::handleLoadSection(b<br>
<br>
 void LLIChildTarget::handleExecute() {<br>
   // Read the message data size.<br>
-  uint32_t DataSize;<br>
+  uint32_t DataSize = 0;<br>
   int rc = ReadBytes(&DataSize, 4);<br>
   (void)rc;<br>
   assert(rc == 4);<br>
   assert(DataSize == 8);<br>
<br>
   // Read the target address.<br>
-  uint64_t Addr;<br>
+  uint64_t Addr = 0;<br>
   rc = ReadBytes(&Addr, 8);<br>
   assert(rc == 8);<br>
<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@cs.uiuc.edu" target="_blank">llvm-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
</blockquote></div></div></div><br></div></blockquote></div></div></div>
</div></div></blockquote></div></div>