[LLVMbugs] [Bug 5601] New: llvm-as: ParseFunctionHeader in LLParser. cpp poorly handles incorrect forward declarations

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Tue Nov 24 01:04:08 PST 2009


           Summary: llvm-as: ParseFunctionHeader in LLParser.cpp poorly
                    handles incorrect forward declarations
           Product: new-bugs
           Version: 2.6
          Platform: Macintosh
        OS/Version: MacOS X
            Status: NEW
          Severity: normal
          Priority: P2
         Component: new bugs
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: arlencox at gmail.com
                CC: llvmbugs at cs.uiuc.edu

Created an attachment (id=3860)
 --> (http://llvm.org/bugs/attachment.cgi?id=3860)
A minimal testcase to cause the failure

A forward function declaration, if it has a greater number of arguments than is
used in the file, will cause an assertion error instead of a type mismatch

In LLParser.cpp, line 2538:
  // Add all of the arguments we parsed to the function.
  Function::arg_iterator ArgIt = Fn->arg_begin();
  for (unsigned i = 0, e = ArgList.size(); i != e; ++i, ++ArgIt) {
    // If the argument has a name, insert it into the argument symbol table.
    if (ArgList[i].Name.empty()) continue;

    // Set the name, if it conflicted, it will be auto-renamed.

    if (ArgIt->getNameStr() != ArgList[i].Name)
      return Error(ArgList[i].Loc, "redefinition of argument '%" +
                   ArgList[i].Name + "'");

I don't believe ArgIt should always be incremented.  If ArgIt reaches the end
before i == e, a type error should be raised.

Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

More information about the llvm-bugs mailing list