[llvm-bugs] [Bug 25556] New: Segfault in inferPrototypeAttributes

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Nov 17 10:38:14 PST 2015


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

            Bug ID: 25556
           Summary: Segfault in inferPrototypeAttributes
           Product: tools
           Version: 3.7
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: opt
          Assignee: unassignedbugs at nondot.org
          Reporter: peter at trailofbits.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

opt produces a NULL-pointer dereference when trying to infer the prototype of a
declaration of __isoc99_sscanf.

If __isoc99_sscanf is declared as having only a single argument then the
following code segfaults when trying to access the parameter type of param 1.

File: llvm/lib/Transforms/IPO/FunctionAttrs.cpp
Function: inferPrototypeAttributes

1714      case LibFunc::dunder_isoc99_sscanf:
1715        if (FTy->getNumParams() < 1 || !FTy->getParamType(0)->isPointerTy()
||
1716            !FTy->getParamType(1)->isPointerTy())
1717          return false;

I have ensured that my declaration of __isoc99_sscanf is attributed with
llvm::Attribute::NoBuiltin but this attribute appears to be ignored during this
inference phase. The only checked attribute is llvm::Attribute::OptimizeNone.

-- 
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/20151117/bd4c281e/attachment.html>


More information about the llvm-bugs mailing list