diff options
author | Khem Raj <raj.khem@gmail.com> | 2023-01-17 11:07:34 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-17 20:07:34 +0100 |
commit | 90e233a85b9953e084a145e2b4ff0638adc9369a (patch) | |
tree | 4eff66c227c0f6d7770f5e654ba528c078ae20d4 /numpy/array_api/_array_object.py | |
parent | 9b6a7b4f874f5502112f36d485b12d92889eb808 (diff) | |
download | numpy-90e233a85b9953e084a145e2b4ff0638adc9369a.tar.gz |
BUG: use `_Alignof` rather than `offsetof()` on most compilers (#23016)
WG14 N2350 made very clear that it is an UB having type definitions
within "offsetof" [1]. This patch enhances the implementation of macro
_ALIGN to use builtin "_Alignof" to avoid undefined behavior on
when using std=c11 or newer
clang 16+ has started to flag this [2]
Fixes build when using -std >= gnu11 and using clang16+
Older compilers gcc < 4.9 or clang < 8 has buggy _Alignof even though it
may support C11, exclude those compilers too
[1] https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2350.htm
[2] https://reviews.llvm.org/D133574
Signed-off-by: Khem Raj <raj.khem@gmail.com>
* Apply suggestions from code review
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Co-authored-by: Sebastian Berg <sebastian@sipsolutions.net>
Diffstat (limited to 'numpy/array_api/_array_object.py')
0 files changed, 0 insertions, 0 deletions