<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Bad RuleMatcher static_cast in GlobalISelEmitter"
   href="https://bugs.llvm.org/show_bug.cgi?id=40342">40342</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Bad RuleMatcher static_cast in GlobalISelEmitter
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>new-bugs
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>new bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>jacobly.alt@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>htmldeveloper@gmail.com, llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=21339" name="attach_21339" title="Add RTTI to the Matcher class causing build failure.">attachment 21339</a> <a href="attachment.cgi?id=21339&action=edit" title="Add RTTI to the Matcher class causing build failure.">[details]</a></span>
Add RTTI to the Matcher class causing build failure.

I was making some changes to TableGen's GlobalISelEmitter.cpp and I started
getting random crashes.  After adding LLVM-style RTTI to Matcher and its 3
subclasses I was able to catch an incorrect static_cast in GroupMatcher::emit
which is trying to cast from Matcher to RuleMatcher when the actual type is
GroupMatcher.  This appears to cause so few issues because the passed parameter
is only used by a couple of the emitPredicateOpcodes overrides.  This item
seems to be added to the Matcher array in
GlobalISelEmitter::optimizeRules<GroupMatcher> on the line
OptRules.push_back(CurrentGroup.get());.  Repro is to apply the attached patch
and attempt a debug build which triggers a cast assertion.</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>