Skip to content

Commit b102e4f

Browse files
bpo-37415: Fix stdatomic.h header check for ICC compiler (GH-16717)
Fix stdatomic.h header check for ICC compiler: the ICC implementation lacks atomic_uintptr_t type which is needed by Python. Test: * atomic_int and atomic_uintptr_t types * atomic_load_explicit() and atomic_store_explicit() * memory_order_relaxed and memory_order_seq_cst constants But don't test ATOMIC_VAR_INIT(): it's not used in Python. (cherry picked from commit 028f734) Co-authored-by: Victor Stinner <[email protected]>
1 parent d4dc4a5 commit b102e4f

File tree

4 files changed

+14
-6
lines changed

4 files changed

+14
-6
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Fix stdatomic.h header check for ICC compiler: the ICC implementation lacks
2+
atomic_uintptr_t type which is needed by Python.

configure

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16849,9 +16849,12 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
1684916849
1685016850
1685116851
#include <stdatomic.h>
16852-
atomic_int value = ATOMIC_VAR_INIT(1);
16852+
atomic_int int_var;
16853+
atomic_uintptr_t uintptr_var;
1685316854
int main() {
16854-
int loaded_value = atomic_load(&value);
16855+
atomic_store_explicit(&int_var, 5, memory_order_relaxed);
16856+
atomic_store_explicit(&uintptr_var, 0, memory_order_relaxed);
16857+
int loaded_value = atomic_load_explicit(&int_var, memory_order_seq_cst);
1685516858
return 0;
1685616859
}
1685716860

configure.ac

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5492,9 +5492,12 @@ AC_LINK_IFELSE(
54925492
[
54935493
AC_LANG_SOURCE([[
54945494
#include <stdatomic.h>
5495-
atomic_int value = ATOMIC_VAR_INIT(1);
5495+
atomic_int int_var;
5496+
atomic_uintptr_t uintptr_var;
54965497
int main() {
5497-
int loaded_value = atomic_load(&value);
5498+
atomic_store_explicit(&int_var, 5, memory_order_relaxed);
5499+
atomic_store_explicit(&uintptr_var, 0, memory_order_relaxed);
5500+
int loaded_value = atomic_load_explicit(&int_var, memory_order_seq_cst);
54985501
return 0;
54995502
}
55005503
]])
@@ -5504,7 +5507,7 @@ AC_MSG_RESULT($have_stdatomic_h)
55045507

55055508
if test "$have_stdatomic_h" = yes; then
55065509
AC_DEFINE(HAVE_STD_ATOMIC, 1,
5507-
[Has stdatomic.h with atomic_int])
5510+
[Has stdatomic.h with atomic_int and atomic_uintptr_t])
55085511
fi
55095512

55105513
# Check for GCC >= 4.7 __atomic builtins

pyconfig.h.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -963,7 +963,7 @@
963963
/* Define to 1 if you have the <stdlib.h> header file. */
964964
#undef HAVE_STDLIB_H
965965

966-
/* Has stdatomic.h with atomic_int */
966+
/* Has stdatomic.h with atomic_int and atomic_uintptr_t */
967967
#undef HAVE_STD_ATOMIC
968968

969969
/* Define to 1 if you have the `strdup' function. */

0 commit comments

Comments
 (0)