<< Back to previous view

[PCC-33] Verification of function arguments not working for function pointers Created: 14/Feb/09  Updated: 14/Feb/09

Status: Open
Project: pcc
Component/s: C frontend
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Gregory McGarry Assignee: Anders Magnusson
Resolution: Unresolved Votes: 0
Environment: OS X/i386 10.5


 Description   
The following code doesn't compile due to an invalid verification of the function arguments. OSX/ppc segfaults on the same code.


typedef int (*MyFunc)(const char *fmt, ...);

int
print(const char *fmt, ...)
{
}

static MyFunc func = (MyFunc)print;

MyFunc
getFunc(void)
{
        return func;
}

int
main(void)
{
        return (*(getFunc()))("%d\n", 10);
}




 Comments   
Comment by Anders Magnusson [ 14/Feb/09 10:27 AM ]
This has been a problem ~forever, and is difficult to handle. On most places where it shows up I have tried to avoid typechecking.
Generated at Sat Apr 19 07:49:58 CEST 2014 using JIRA Enterprise Edition, Version: 3.13.1-#333.