[New-bugs-announce] [issue40052] Incorrect pointer alignment in _PyVectorcall_Function() of cpython/abstract.h
Andreas Schneider
report at bugs.python.org
Tue Mar 24 02:58:12 EDT 2020
New submission from Andreas Schneider <asn at cryptomilk.org>:
In file included from /builds/cryptomilk/pam_wrapper/src/python/pypamtest.c:21:
In file included from /usr/include/python3.8/Python.h:147:
In file included from /usr/include/python3.8/abstract.h:837:
/usr/include/python3.8/cpython/abstract.h:91:11: error: cast from 'char *' to 'vectorcallfunc *' (aka 'struct _object *(**)(struct _object *, struct _object *const *, unsigned long, struct _object *)') increases required alignment from 1 to 8 [-Werror,-Wcast-align]
ptr = (vectorcallfunc*)(((char *)callable) + offset);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
The correct way to do it would be:
union {
char *data;
vectorcallfunc *ptr;
} vc;
vc.data = (char *)callable + offset;
return *vc.ptr;
----------
components: C API
messages: 364919
nosy: asn
priority: normal
severity: normal
status: open
title: Incorrect pointer alignment in _PyVectorcall_Function() of cpython/abstract.h
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue40052>
_______________________________________
More information about the New-bugs-announce
mailing list