[LLVMbugs] [Bug 7478] New: Assertion `(NumParams == FTy->getNumParams() || (FTy->isVarArg() && NumParams > FTy->getNumParams())) && "Calling a function with bad signature!"'

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Jun 23 18:58:02 PDT 2010


http://llvm.org/bugs/show_bug.cgi?id=7478

           Summary: Assertion `(NumParams == FTy->getNumParams() ||
                    (FTy->isVarArg() && NumParams > FTy->getNumParams()))
                    && "Calling a function with bad signature!"'
           Product: tools
           Version: 2.6
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: llvm-gcc
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: Nathan.Keynes at sun.com
                CC: llvmbugs at cs.uiuc.edu


llvm-gcc raises an internal compiler error on the following (ugly, but
nonetheless considered valid by gcc) test case:

typedef void (*fnptr)(int,int *);
void foo( fnptr fn )
{
  (*( (void (*)()) fn))(4, 5, 2, fn);
}

On the other hand, the following does work correctly:

typedef void (*fnptr)(int,int *);
void foo( fnptr fn )
{
  (*( (void (*)(int,int,int,void*)) fn))(4, 5, 2, fn);
}

It looks like gcc emits an explicit MODIFY_EXPR in the tree for the second
case, but not for the first, so EmitCALL_EXPR receives an uncast fn, leading to
the assertion failure above when it tries to construct the Call.

I'm not sure what the correct fix is here - possibly the Builder needs to check
for function/arg agreement and insert a cast if necessary?

This is reproduceable with (at least) 2.6 and 2.7 and trunk, and on Linux,
Solaris + OS X

-- 
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