Author siddhesh
Recipients cstratak, serhiy.storchaka, siddhesh, ztane
Date 2018-03-15.12:07:38
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1521115658.42.0.467229070634.issue33012@psf.upfronthosting.co.za>
In-reply-to
Content
> I don't have GCC 8 so I cannot verify this bug, but *function pointer casts* are fine - any function pointer can be cast to any other function pointer - it is only that they must *not* be called unless cast back again to be compatible with the function definition. Any fix to the contrary might well *cause* undefined behaviour!

Please see the attached PR; METH_NOARGS callbacks are inconsistent in their signature and many have just one argument while they're called with two arguments, the second being NULL.  The patch fixes these to consistently take and call with two arguments.

> Could you provide a sample of the *actual warnings* so that they could be studied?

Here's one of a few hundred.

Objects/bytesobject.c:3085:25: warning: cast between incompatible function types from ‘PyObject * (*)(striterobject *)’ {aka ‘struct _object * (*)(struct <anonymous> *)’} to ‘PyObject * (*)(PyObject *, PyObject *)’ {aka ‘struct _object * (*)(struct _object *, struct _object *)’} [-Wcast-function-type]
     {"__reduce__",      (PyCFunction)striter_reduce, METH_NOARGS,
                         ^
This is a new warning in gcc8, so you'll likely not find much reference, but here's a gcc bug report that might give you more context:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84531
History
Date User Action Args
2018-03-15 12:07:38siddheshsetrecipients: + siddhesh, serhiy.storchaka, ztane, cstratak
2018-03-15 12:07:38siddheshsetmessageid: <1521115658.42.0.467229070634.issue33012@psf.upfronthosting.co.za>
2018-03-15 12:07:38siddheshlinkissue33012 messages
2018-03-15 12:07:38siddheshcreate