8000 + comment on clang workaround · python/cpython@45f8544 · GitHub
[go: up one dir, main page]

Skip to content

Commit 45f8544

Browse files
committed
+ comment on clang workaround
1 parent 6755905 commit 45f8544

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

Modules/_ctypes/cfield.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1092,6 +1092,17 @@ d_get(void *ptr, Py_ssize_t size)
10921092
}
10931093

10941094
#ifdef __STDC_IEC_559_COMPLEX__
1095+
/* Other compilers (than clang), that claims to
1096+
implement C11 *and* define __STDC_IEC_559_COMPLEX__ don't have
1097+
issue with CMPLX(). This is specific to glibc & clang combination:
1098+
https://sourceware.org/bugzilla/show_bug.cgi?id=26287
1099+
1100+
Here we fallback to using __builtin_complex(), available in clang
1101+
v12+. Unfortunatelly, it's impossible to emulate CMPLX(), using
1102+
only complex arithmetic, if implemented only mixed-mode rules
1103+
for "complex op real" cases (as most compilers do):
1104+
think about CMPLX(1, NAN).
1105+
*/
10951106
#if defined(__clang__) && __has_builtin(__builtin_complex) && \
10961107
!defined(CMPLX)
10971108
# define CMPLX(x, y) __builtin_complex ((double) (x), (double) (y))

0 commit comments

Comments
 (0)
0