Skip to content

BUG: Fix warning "differs in levels of indirection" in npy_atomic.h with MSVC #27574

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 16, 2024

Conversation

charris
Copy link
Member

@charris charris commented Oct 16, 2024

Backport of #27557.

This pr is to fix #27547
Fixed a warning in MSVC (C4047) that occurs due to a mismatch in levels of
indirection between 'void *' and 'volatile uint64_t'. The issue arises in the
MSC_ATOMICS section where a return statement in npy_atomic.h attempts to
return a uint64_t value, but the function expects a void pointer.

The fix involves casting the uint64_t result back to a void pointer using
(uintptr_t) to ensure compatibility and eliminate the warning.

Tested on MSVC 19.29 with numpy 2.1.2 to verify that the warning no longer
appears during compilation.

  • 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

  • Update numpy/_core/src/common/npy_atomic.h

  • Update numpy/_core/src/common/npy_atomic.h

  • Update numpy/_core/src/common/npy_atomic.h

  • Update numpy/_core/src/common/npy_atomic.h


…ith 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 <nathan.goldbaum@gmail.com>

* Update numpy/_core/src/common/npy_atomic.h

Co-authored-by: Nathan Goldbaum <nathan.goldbaum@gmail.com>

* Update numpy/_core/src/common/npy_atomic.h

Co-authored-by: Nathan Goldbaum <nathan.goldbaum@gmail.com>

* Update numpy/_core/src/common/npy_atomic.h

Co-authored-by: Nathan Goldbaum <nathan.goldbaum@gmail.com>

* Update numpy/_core/src/common/npy_atomic.h

Co-authored-by: Nathan Goldbaum <nathan.goldbaum@gmail.com>

---------

Co-authored-by: Nathan Goldbaum <nathan.goldbaum@gmail.com>
@charris charris added 00 - Bug 08 - Backport Used to tag backport PRs labels Oct 16, 2024
@charris charris added this to the 2.1.3 release milestone Oct 16, 2024
@charris charris merged commit 00cdaac into numpy:maintenance/2.1.x Oct 16, 2024
65 checks passed
@charris charris deleted the backport-27557 branch October 16, 2024 14:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
00 - Bug 08 - Backport Used to tag backport PRs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants