New submission from Andreas Schneider <a...@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 <rep...@bugs.python.org>
<https://bugs.python.org/issue40052>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to