[issue39689] struct and memoryview tests rely on undefined behavior (as revealed by clang 9)

Stefan Krah report at bugs.python.org
Wed Mar 11 14:41:28 EDT 2020


Stefan Krah <stefan at bytereef.org> added the comment:

Concerning memoryview, I've looked at this very briefly: memoryview
does not pack values directly, it casts first, which is legal:


#define PACK_SINGLE(ptr, src, type) \
    do {                                     \
        type x;                              \
        x = (type)src;                       \
        memcpy(ptr, (char *)&x, sizeof x);   \
    } while (0)


This macro has exposed compiler bugs before.

----------
nosy: +skrah

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue39689>
_______________________________________


More information about the Python-bugs-list mailing list