[llvm-bugs] [Bug 40342] New: Bad RuleMatcher static_cast in GlobalISelEmitter

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Jan 16 12:43:27 PST 2019


https://bugs.llvm.org/show_bug.cgi?id=40342

            Bug ID: 40342
           Summary: Bad RuleMatcher static_cast in GlobalISelEmitter
           Product: new-bugs
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: jacobly.alt at gmail.com
                CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org

Created attachment 21339
  --> https://bugs.llvm.org/attachment.cgi?id=21339&action=edit
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.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20190116/590d4bcc/attachment.html>


More information about the llvm-bugs mailing list