Hi Anshu,<div><br></div><div>no, I did not fill a bug report. It is not so easy to make the code fail noticeably; during Hexagon CodeGen tests it happens silently and tests pass. I am working on another VLIW backend which uses DFAPacketizer and compiling llvm with gcc-4.4 makes it segfault, but with gcc-4.7 the bug gets hidden again (it still happens, but values after DFAStateEntryTable in memory are such that ReadTable does not break bad).</div>
<div><br></div><div>If you find more info will help you track it down just let me know :)</div><div><br></div><div>BR</div><div><br></div><div>Carlos</div><div class="gmail_extra"><br><br><div class="gmail_quote">2012/12/10 Anshuman Dasgupta <span dir="ltr"><<a href="mailto:adasgupt@codeaurora.org" target="_blank">adasgupt@codeaurora.org</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div text="#000000" bgcolor="#FFFFFF">
<div><tt>Hi Carlos,</tt><tt><br>
</tt><tt><br>
</tt><tt>Thanks for identifying the bug. </tt><tt><tt>I'll
confirm and fix.</tt> Is there a bug report open for this? </tt><tt><br>
</tt><tt><br>
</tt><tt>-Anshu</tt><tt><br>
</tt><tt><br>
</tt><tt>---
</tt><tt><br>
</tt><tt>Qualcomm Innovation Center, Inc. is a member of Code
Aurora Forum, hosted by The Linux Foundation
</tt><tt><br>
</tt><div><div class="h5">
<tt><br>
</tt><tt><br>
</tt><tt><br>
</tt><tt>On 12/10/2012 4:48 AM, Carlos Sánchez de La Lama wrote:</tt><tt><br>
</tt></div></div></div>
<blockquote type="cite"><div><div class="h5"><tt>Hi all,</tt><tt><br>
</tt><tt><br>
</tt><tt>I have found what I think it is a bug in
DFAPacketizer::ReadTable.</tt><tt><br>
</tt><tt><br>
</tt><tt>When finding NextStateInTable to cache all transitions
belonging to a state into CachedTable, ReadTable does not check
bounds:</tt><tt><br>
</tt><tt><br>
</tt><tt>
unsigned ThisState =
DFAStateEntryTable[state];
|</tt><tt><br>
</tt><tt>unsigned NextStateInTable =
DFAStateEntryTable[state+1]; </tt><tt><br>
</tt><tt><br>
</tt><tt>which makes NextStateInTable get a random value when
state == <last state in table>. Behaviour changes
depending on gcc version / platform / ..., but in some cases
might lead to segmentation faults.</tt><tt><br>
</tt>
<tt><br>
</tt><tt>I have checked the problem happens in Hexagon tests (for
example fadd.ll test) but does not break badly there (though
CachedTable will get some unneded and random data rows).</tt><tt><br>
</tt><tt><br>
</tt><tt>Probably making tblgen add an end-of-table marker in
<Target>DFAStateEntryTable is the easiest solution.</tt><tt><br>
</tt>
<tt><br>
</tt><tt>BR</tt><tt><br>
</tt><tt><br>
</tt><tt>Carlos</tt><tt><br>
</tt>
<tt><br>
</tt>
<fieldset></fieldset>
<tt><br>
</tt>
</div></div><pre>_______________________________________________
LLVM Developers mailing list
<a href="mailto:LLVMdev@cs.uiuc.edu" target="_blank">LLVMdev@cs.uiuc.edu</a> <a href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a>
</pre>
</blockquote>
<tt><br>
</tt>
</div>
</blockquote></div><br></div>