Skip to content

Commit 4e7f657

Browse files
BUG: Fix warning "differs in levels of indirection" in npy_atomic.h with MSVC (numpy#27557)
* Fix pointer indirection warning (C4047) in npy_atomic.h for MSVC * Fix pointer indirection warning (C4047) in npy_atomic.h for MSVC * Fix atomic pointer loading with proper type casting for various architectures * Update numpy/_core/src/common/npy_atomic.h Co-authored-by: Nathan Goldbaum <[email protected]> * Update numpy/_core/src/common/npy_atomic.h Co-authored-by: Nathan Goldbaum <[email protected]> * Update numpy/_core/src/common/npy_atomic.h Co-authored-by: Nathan Goldbaum <[email protected]> * Update numpy/_core/src/common/npy_atomic.h Co-authored-by: Nathan Goldbaum <[email protected]> * Update numpy/_core/src/common/npy_atomic.h Co-authored-by: Nathan Goldbaum <[email protected]> --------- Co-authored-by: Nathan Goldbaum <[email protected]>
1 parent 961b70f commit 4e7f657

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

numpy/_core/src/common/npy_atomic.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,15 +53,15 @@ npy_atomic_load_ptr(const void *obj) {
5353
#elif defined(MSC_ATOMICS)
5454
#if SIZEOF_VOID_P == 8
5555
#if defined(_M_X64) || defined(_M_IX86)
56-
return *(volatile uint64_t *)obj;
56+
return (void *)*(volatile uint64_t *)obj;
5757
#elif defined(_M_ARM64)
58-
return (uint64_t)__ldar64((unsigned __int64 volatile *)obj);
58+
return (void *)__ldar64((unsigned __int64 volatile *)obj);
5959
#endif
6060
#else
6161
#if defined(_M_X64) || defined(_M_IX86)
62-
return *(volatile uint32_t *)obj;
62+
return (void *)*(volatile uint32_t *)obj;
6363
#elif defined(_M_ARM64)
64-
return (uint32_t)__ldar32((unsigned __int32 volatile *)obj);
64+
return (void *)__ldar32((unsigned __int32 volatile *)obj);
6565
#endif
6666
#endif
6767
#elif defined(GCC_ATOMICS)

0 commit comments

Comments
 (0)