cpc icon indicating copy to clipboard operation
cpc copied to clipboard

Error: wrong number of arguments in function call for typedef's in structures

Open ctshepherd opened this issue 12 years ago • 6 comments

Using the sample file, I get the error:

Error: coroutine-cpc.c:10: wrong number of arguments in function call: *(s->f)
Fatal error: exception Errormsg.Error

I think this is due to the assertion at line 1839 in src/ext/cpc.ml failing, however I was unable to debug it further. Hopefully this is a pretty minimal testcase.

ctshepherd avatar Jul 10 '13 00:07 ctshepherd

Attachment is at http://codepad.org/K4ETqqP7

ctshepherd avatar Jul 10 '13 00:07 ctshepherd

Copy/pasting regression case for future reference:

typedef void __attribute__((cps)) CoroutineEntry(void *opaque);

struct st {
    CoroutineEntry *f;
    void *n;
};

void __attribute__((cps)) g(struct st *s)
{
    s->f(s->n);

}

kerneis avatar Jul 10 '13 06:07 kerneis

Thanks for the report. I suspect this might be because I do not unroll the typedef at some point (or even more likely, since it only occurs with structure fields, that I don't perform a "deep unrolling"). Should hopefully be easy to fix.

kerneis avatar Jul 10 '13 06:07 kerneis

Weird: replacing s->f(s->n) by s->f(NULL) removes the error. No idea why (probably some implicit cast being added by CIL), but it explains why my previous tests missed that case.

kerneis avatar Jul 10 '13 07:07 kerneis

I'm still seeing this issue:

Error: /home/cs648/qemu/savevm.c:697: wrong number of arguments in function call: *((f->ops)->get_buffer)

savevm.c: http://codepad.org/N2JuwluQ savevm.i: http://codepad.org/CNEJp1YH

ctshepherd avatar Sep 05 '13 23:09 ctshepherd

On Thu, Sep 05, 2013 at 04:35:08PM -0700, Charlie Shepherd wrote:

I'm still seeing this issue:

Error: /home/cs648/qemu/savevm.c:697: wrong number of arguments in function call: *((f->ops)->get_buffer)

Maybe we need unrollTypeDeep instead of unrollType.

savevm.c: http://codepad.org/N2JuwluQ savevm.i: http://codepad.org/CNEJp1YH

But I cannot test because codepad.org truncates your files!

kerneis avatar Sep 06 '13 06:09 kerneis