<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <div class="moz-cite-prefix"><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><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><tt>On 12/10/2012 1:01 PM, Carlos Sánchez de La Lama wrote:</tt><tt><br>
      </tt></div>
    <blockquote
cite="mid:CA+KcR8A=FSe799_SaDv9POif0VdTVCy2D3crY0wNFRnJBFDHxw@mail.gmail.com"
      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 moz-do-not-send="true"
                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 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 moz-do-not-send="true" href="mailto:LLVMdev@cs.uiuc.edu" target="_blank">LLVMdev@cs.uiuc.edu</a>         <a moz-do-not-send="true" href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a>
<a moz-do-not-send="true" 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>
  </body>
</html>