xslt.pxi: calls to _copyXSLT() cast to the wrong type - lxml fails to build with GCC 14
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
lxml |
New
|
Undecided
|
Unassigned |
Bug Description
lxml fails to build with GCC 14. Apparently, GCC 14 switched -Wincompatible-
xslt.pki:
new_
this code generates:
__pyx_t_2 = ((PyObject *)__pyx_
It casts the first argument to the type: "struct __pyx_obj_
The _copy() function is defined xslt.pki by:
cdef _BaseContext _copy(self):
cdef _XSLTContext context
context = <_XSLTContext>
return context
Cython generates the prototype:
static struct __pyx_obj_
The first parameter type (self) is: "struct __pyx_obj_
XSLT._context is defined in xslt.pki with:
@cython.
cdef class XSLT:
cdef _XSLTContext _context
Well, I see different options:
* Change XSLT._context type to type expected by _copy(): _BaseContext
* Cast XSLT._context to _BaseContext somehow
* Change _copy() parameter type to _XSLTContext?
Extract of GCC 13 compiler warnings if I pass manually -Wincompatible-
---
$ gcc -fno-strict-
(...)
src/lxml/etree.c: In function '__pyx_
src/lxml/
225042 | __pyx_t_2 = ((PyObject *)__pyx_
| ~^~~~~~
| |
| struct __pyx_obj_
src/lxml/
222496 | static struct __pyx_obj_
| ~~~~~~~
src/lxml/etree.c: In function '__pyx_
src/lxml/
226859 | __pyx_t_2 = ((PyObject *)__pyx_
| ~^~~~~~
| |
| struct __pyx_obj_
src/lxml/
222496 | static struct __pyx_obj_
| ~~~~~~~
---
I attach the full output as attached warnings.log.
Example of commands to get the warnings (tested on Fedora with GCC 13):
$ git clean -fdx
$ CFLAGS= "-Wincompatible -pointer- types" python3 setup.py build_ext --warnings 2>&1|tee build.log
$ grep copy build.log etree.c: 225039: 73: warning: passing argument 1 of ‘__pyx_ f_4lxml_ 5etree_ 12_XSLTContext_ _copy’ from incompatible pointer type [-Wincompatible -pointer- types]
(...)
src/lxml/
(...)