-
Notifications
You must be signed in to change notification settings - Fork 390
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
fixes #2568. MSVC optimizations causing segmentation faults in optimized builds. #2628
fixes #2568. MSVC optimizations causing segmentation faults in optimized builds. #2628
Conversation
Thanks a lot! It could be nice to do the workaround only on MSVC (on potentially only on the affected version) using some pre-processor statement? |
780a8ed
to
6f46297
Compare
pushed with msvc guards. I also added a test which I think covers all 3 issues. |
I would have probably only added #if defined(_MSC_VER) && (1931 <= _MSC_VER)
// Workaround MSVC compiler optimization bug, xtensor#2568
if (shape.size() == 0) {
return static_cast<std::size_t>(data_size);
}
#endif to keep the implementation cleaner. That should work too no? |
oh. yes, that's much better. I'll fix that up |
…on faults in optimized (/O1 /O2 builds. - this should fix 0-sized xarrays, xtensors (xt::xtensor<size_t, 0>), xt::argmax()
6f46297
to
24bf6ee
Compare
This is amazing! It may be worth adding a comment and a reference to this compiler issue in https://xtensor.readthedocs.io/en/latest/compilers.html. |
Would something like the following do? (not so familiar with .rst)
|
26523e5
to
14a54c5
Compare
Great! Good to go. Thanks a lot for getting to the bottom of this |
Works around an msvc optimizer bug which occurs when shape.size() == 0.
Surrounding the problematic region to prevent illegal access that occurs on windows MSVC optimized builds (/O1, /O2).
Checklist
Description
Fixes #2551
Fixes #2568
Fixes #2596