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: [email protected]
          Reporter: [email protected]
                CC: [email protected]
    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.
_______________________________________________
llvm-bugs mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to