Hi Anshu,<br><br>I got a testbench which fails (and segfaults) consistently with an environment (gcc + os) conveniently preserved in a virtual machine. I will confirm that it is gone there and report.<br><br>Thanks for the fix :)<br>
<br>Carlos<br><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>Carlos,</tt><tt><br>
      </tt><tt><br>
      </tt><tt>I committed a fix in r169783. Thanks for catching this.</tt><tt><br>
      </tt><tt><br>
      </tt><tt>However, I could not reproduce an invalid read or a
        segfault even with fadd.ll. Is there a test case you can check
        in that reproduces this bug? Even if the segfault occurs
        intermittently, that's better than no test case at all.</tt><tt><br>
      </tt><tt><br>
      </tt><tt>Thanks</tt><div class="im"><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>
        <br>
      </tt><tt><br>
      </tt></div><div><div class="h5"><tt>On 12/10/2012 1:01 PM, Carlos Sánchez de La Lama wrote:</tt><tt><br>
      </tt></div></div></div><div><div class="h5">
    <blockquote type="cite"><tt>Hi Anshu,</tt>
      <div><tt><br>
        </tt></div>
      <div><tt>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).</tt></div>
      <div><tt><br>
        </tt></div>
      <div><tt>If you find more info will help you track it down just
          let me know :)</tt></div>
      <div><tt><br>
        </tt></div>
      <div><tt>BR</tt></div>
      <div><tt><br>
        </tt></div>
      <div><tt>Carlos</tt></div>
      <div class="gmail_extra"><tt><br>
        </tt><tt><br>
        </tt>
        <div class="gmail_quote"><tt>2012/12/10 Anshuman Dasgupta </tt><tt><span dir="ltr"><<a href="mailto:adasgupt@codeaurora.org" target="_blank">adasgupt@codeaurora.org</a>></span></tt><tt><br>
          </tt>
          <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>I'll

                  confirm and fix.</tt><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> <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><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>
        <tt><br>
        </tt></div>
    </blockquote>
    <tt><br>
    </tt>
  </div></div></div>

</blockquote></div><br></div>