-
-
Notifications
You must be signed in to change notification settings - Fork 10.9k
BUG: segfault when array with dtype=np.float32 is sliced then squared #25231
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
Comments
@RoryMB In windows i tried and we are not getting any segfault error .Any Advice |
Thanks for the report! I am not immediately sure what is wrong. @seiko2plus can you have a quick look. The lldb backtrace seems pretty clear, I would suspect we access one element too many, but at this point it is still a guess.
|
Ahh, squinting at it But, |
Describe the issue:
The code example creates a large array, sets the dtype to np.float32 and slices, then segfaults fairly consistently upon squaring the result.
Smaller array size values (e.g.
1024 * 1024 * 2
, which produces only a 32MB structure) are less likely to segfault, but still crash often.Things I tried that DID cause segfaults:
np.zeros((1024*1024*64, 2)).astype(np.float32)[:, 1]**2
np.zeros((1024*1024*2, 2)).astype(np.float32)[:, 1]**2
np.zeros((1024*1024*64, 2), dtype=np.float32)[:, 1]**2
np.ones((1024*1024*64, 2), dtype=np.float32)[:, 1]**2
np.zeros((1024*1024*64*2)).reshape((-1, 2)).astype(np.float32)[:, 1]**2
Things I tried that DID NOT cause segfaults:
np.zeros((1024*1024*64, 2)).astype(np.float32)[:, 0]**2
np.zeros((1024*1024*64, 2)).astype(np.float32)[:, 1]
np.zeros((1024*1024*64, 2)).astype(np.float32)**2
np.zeros((1024*1024*64, 2))[:, 1]**2
Reproduce the code example:
Error message:
Runtime information:
M1 Max MacBook Pro
NumPy installed through
pip install -U numpy
Context for the issue:
No response
The text was updated successfully, but these errors were encountered: