-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Runtime error with gcc 13 #5030
Comments
note, this only happens with
➜ src git:(master) ✗ git --no-pager diff
diff --git a/src/position.cpp b/src/position.cpp
index c89b1eb0..1ac6f187 100644
--- a/src/position.cpp
+++ b/src/position.cpp
@@ -669,7 +669,13 @@ void Position::do_move(Move m, StateInfo& newSt, bool givesCheck) {
// Copy some fields of the old state to our new StateInfo object except the
// ones which are going to be recalculated from scratch anyway and then switch
// our state pointer to point to the new (ready to be updated) state.
+ std::cout << &newSt << std::endl;
+ std::cout << (reinterpret_cast<uintptr_t>(&newSt) % 64UL) << std::endl;
+ ASSERT_ALIGNED(&newSt, Eval::NNUE::CacheLineSize);
+ ASSERT_ALIGNED(st, Eval::NNUE::CacheLineSize);
std::memcpy(&newSt, st, offsetof(StateInfo, key));
+ ASSERT_ALIGNED(&newSt, Eval::NNUE::CacheLineSize);
+ ASSERT_ALIGNED(st, Eval::NNUE::CacheLineSize);
newSt.previous = st;
st = &newSt;
diff --git a/src/search.cpp b/src/search.cpp
index e57f2557..ead3dd78 100644
--- a/src/search.cpp
+++ b/src/search.cpp
@@ -26,8 +26,9 @@
#include <cstdlib>
#include <initializer_list>
#include <iostream>
-#include <utility>
+#include <memory>
#include <sstream>
+#include <utility>
#include "evaluate.h"
#include "misc.h"
@@ -1102,6 +1103,10 @@ moves_loop: // When in check, search starts here
// Step 16. Make the move
thisThread->nodes.fetch_add(1, std::memory_order_relaxed);
+ std::cout << &st << std::endl;
+ std::cout << (reinterpret_cast<uintptr_t>(&st) % 64UL) << std::endl;
+
+ ASSERT_ALIGNED(&st, Eval::NNUE::CacheLineSize);
pos.do_move(move, st, givesCheck);
// Decrease reduction if position is or has been on the PV (~5 Elo) seems to be some regression with gcc, if someone can come up with a minimal reproduction we can report this to gcc |
I can confirm that there are no run-time Errors with gcc 11 even with the sanitize, and that both stateinfo are aligned there. |
Describe the issue
compiling with gcc 13
make -j build EXTRACXXFLAGS="-g3 -fsanitize=undefined -fsanitize=address" COMPCXX=g++-13
gives run-time errorsRuntime errors output
Operating system
Iinux
Stockfish version
latest
The text was updated successfully, but these errors were encountered: