[llvm-bugs] [Bug 25662] New: llvm::CallInst::hasStructRetAttr cause unexpected assert

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Nov 27 21:57:24 PST 2015


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

            Bug ID: 25662
           Summary: llvm::CallInst::hasStructRetAttr cause unexpected
                    assert
           Product: new-bugs
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: xiulipan at outlook.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

This bug happens when change llvm into 3.8 from svn, it will cause assert of
CallInst::paramHasAttr "Param index out of bounds!"(increased from
http://reviews.llvm.org/D14304)\

In our case, the assert will happen when the CallInst has no
argument(getNumArgOperands() returns 0), and the code for
CallInst::hasStructRetAttr is:

01733     // Be friendly and also check the callee.
01732   bool hasStructRetAttr() const {
01734     return paramHasAttr(1, Attribute::StructRet);
01735   }

It seems the hasStructRetAttr has no bound check and passes invalid value to
paramHasAttr.

Or maybe we used the hasStructRetAttr function incorrectly, and it could not
use to CallInst with no arg. For now we just use a workaround to check the
getNumArgOperands() > 0 first. If we used hasStructRetAttr incorrectly, there
should be a assert in it before it passes some invalid value to others.

-- 
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/20151128/7dc5561d/attachment.html>


More information about the llvm-bugs mailing list