Issue Details (XML | Word | Printable)

Key: PCC-33
Type: Bug Bug
Status: Closed Closed
Resolution: Cannot Reproduce
Priority: Major Major
Assignee: Anders Magnusson
Reporter: Gregory McGarry
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
pcc

Verification of function arguments not working for function pointers

Created: 14/Feb/09 06:41 AM   Updated: 01/May/14 03:22 PM
Component/s: C frontend
Affects Version/s: None
Fix Version/s: None

Environment: OS X/i386 10.5


 Description  « Hide
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);
}




 All   Comments   Change History      Sort Order: Ascending order - Click to sort in descending order
Gregory McGarry made changes - 14/Feb/09 06:42 AM
Field Original Value New Value
Component/s C frontend [ 10010 ]
Anders Magnusson made changes - 14/Feb/09 10:25 AM
Assignee Anders Magnusson [ ragge ]
Anders Magnusson added a comment - 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.

Anders Magnusson added a comment - 01/May/14 03:22 PM
Seems to have been fixed since bug report.

Anders Magnusson made changes - 01/May/14 03:22 PM
Status Open [ 1 ] Closed [ 6 ]
Resolution Cannot Reproduce [ 5 ]