I do not have the commit access.  Please commit that.<div><br></div><div>One question:  How can I get the commit access?  I am a heavy llvm user, and might send in more patches.<span></span><br><br>On Wednesday, February 27, 2013, David Blaikie  wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On Wed, Feb 27, 2013 at 11:33 AM, Peng Cheng <<a href="javascript:;" onclick="_e(event, 'cvml', 'gm4cheng@gmail.com')">gm4cheng@gmail.com</a>> wrote:<br>

> I cannot create an llvm ir for regression test.  I test the llvm ir, which<br>
> causes the uninitialized value in my program, with llc, but cannot reproduce<br>
> the issue with valgrind.  I think that it is related to the order and types<br>
> of different ir transformations between llc and my program, or llc goes to<br>
> the branch to create DataLayout directly from Module, not from copy<br>
> constructor. Maybe someone familiar with the ir transformation details could<br>
> come up a test case.<br>
><br>
> But if you follows the llvm tutorial at<br>
> <a href="http://llvm.org/docs/tutorial/LangImpl4.html" target="_blank">http://llvm.org/docs/tutorial/LangImpl4.html</a><br>
><br>
> OurFPM.add(new DataLayout(*TheExecutionEngine->getDataLayout()));<br>
<br>
Might be nice to have the example code checked in somewhere - not sure<br>
where it would go/how it would be tested.<br>
<br>
Anyway, I'll sign off on this - please commit the change. If you don't<br>
have commit access I can do it for you.<br>
<br>
> This would put a bomb in your code.  When you were lucky, StackNaturalAlign<br>
> is given some value and program works; otherwise, lead to undefined<br>
> behaviors and days to debug...<br>
><br>
><br>
> On Wed, Feb 27, 2013 at 12:05 AM, David Blaikie <<a href="javascript:;" onclick="_e(event, 'cvml', 'dblaikie@gmail.com')">dblaikie@gmail.com</a>> wrote:<br>
>><br>
>> On Tue, Feb 26, 2013 at 8:37 PM, Peng Cheng <<a href="javascript:;" onclick="_e(event, 'cvml', 'gm4cheng@gmail.com')">gm4cheng@gmail.com</a>> wrote:<br>
>> > The usual llvm regression tests for a standard constructor bug seems<br>
>> > like an<br>
>> > overkill, leading to many wasteful code exercises, such as ir reading,<br>
>> > optimization, code generation, ...<br>
>><br>
>> While I'm the last to advocate for indirect testing, this is generally<br>
>> the attitude in the LLVM project - to exercise from the actual<br>
>> user-programs. This ensures better coverage (though not necessarily<br>
>> actually /testing/ all of that, of course) in some ways, worse<br>
>> coverage in others.<br>
>><br>
>> > Are there any other places to place the unit tests for classes in llvm<br>
>> > code<br>
>> > base?  Simply to test whether all the necessary fields are initialized<br>
>> > after<br>
>> > the copy constructor.<br>
>><br>
>> We do have true API-level unit tests as well - just not often written,<br>
>> usually only for core/generic data structures & the like.<br>
>><br>
>> ><br>
>> ><br>
>> > On Tue, Feb 26, 2013 at 10:51 PM, David Blaikie <<a href="javascript:;" onclick="_e(event, 'cvml', 'dblaikie@gmail.com')">dblaikie@gmail.com</a>><br>
>> > wrote:<br>
>> >><br>
>> >> On Tue, Feb 26, 2013 at 7:34 PM, Peng Cheng <<a href="javascript:;" onclick="_e(event, 'cvml', 'gm4cheng@gmail.com')">gm4cheng@gmail.com</a>> wrote:<br>
>> >> > It did not fail on any valgrind bots.  But when I used valgrind to<br>
>> >> > check<br>
>> >> > my<br>
>> >> > jit engine based on llvm, I found the bug.<br>
>> >> ><br>
>> >> > Could you point to me an example of test case for the valgrind bot?<br>
>> >> > I<br>
>> >> > need<br>
>> >> > to see how the test infrastructure is setup in llvm.<br>
>> >><br>
>> >> The current public valgrind bot (<br>
>> >> <a href="http://lab.llvm.org:8011/builders/clang-x86_64-linux-vg" target="_blank">http://lab.llvm.org:8011/builders/clang-x86_64-linux-vg</a> - there may be<br>
>> >> others) just runs the usual LLVM/Clang regression tests. So if you can<br>
>> >> construct a nice small/simple regression test you can add that (&<br>
>> >> limit the test to only running under valgrind, potentially)<br>
>> >><br>
>> >> > On Tue, Feb 26, 2013 at 10:28 PM, David Blaikie <<a href="javascript:;" onclick="_e(event, 'cvml', 'dblaikie@gmail.com')">dblaikie@gmail.com</a>><br>
>> >> > wrote:<br>
>> >> >><br>
>> >> >> On Tue, Feb 26, 2013 at 7:15 PM, Peng Cheng <<a href="javascript:;" onclick="_e(event, 'cvml', 'gm4cheng@gmail.com')">gm4cheng@gmail.com</a>><br>
>> >> >> wrote:<br>
>> >> >> > The copy constructor of class DataLayout fails to initialize<br>
>> >> >> > StackNaturalAlign.  It could lead to conditional jump on<br>
>> >> >> > uninitialized<br>
>> >> >> > variables in member function exceedsNaturalStackAlignment.<br>
>> >> >><br>
>> >> >> Does this fail any valgrind bots? Could you write a test case that<br>
>> >> >> would fail under valgrind?<br>
>> >> >><br>
>> >> >> > See fix in the patch attached.<br>
>> >> >> ><br>
>> >> >> > _______________________________________________<br>
>> >> >> > llvm-commits mailing list<br>
>> >> >> > <a href="javascript:;" onclick="_e(event, 'cvml', 'llvm-commits@cs.uiuc.edu')">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>
>> >> >> ><br>
>> >> ><br>
>> >> ><br>
>> ><br>
>> ><br>
><br>
><br>
</blockquote></div>