From a3f2bddb66d107a76e8143cbc9a19f37f76265b6 Mon Sep 17 00:00:00 2001 From: Gold856 <117957790+Gold856@users.noreply.github.com> Date: Tue, 21 Jan 2025 00:04:41 -0500 Subject: [PATCH] Fix GCC 13 build issues --- examples/TriangulationLOSTExample.cpp | 6 +++--- gtsam/basis/tests/testFourier.cpp | 4 ++++ gtsam/geometry/BearingRange.h | 4 +++- gtsam/geometry/FundamentalMatrix.cpp | 4 ++++ gtsam/slam/tests/testRotateFactor.cpp | 3 +++ 5 files changed, 17 insertions(+), 4 deletions(-) diff --git a/examples/TriangulationLOSTExample.cpp b/examples/TriangulationLOSTExample.cpp index 417c37c459..52744e508b 100644 --- a/examples/TriangulationLOSTExample.cpp +++ b/examples/TriangulationLOSTExample.cpp @@ -123,9 +123,9 @@ int main(int argc, char* argv[]) { double rank_tol = 1e-9; std::shared_ptr calib = std::make_shared(); - std::chrono::nanoseconds durationDLT; - std::chrono::nanoseconds durationDLTOpt; - std::chrono::nanoseconds durationLOST; + std::chrono::nanoseconds durationDLT{}; + std::chrono::nanoseconds durationDLTOpt{}; + std::chrono::nanoseconds durationLOST{}; for (int i = 0; i < nrTrials; i++) { Point2Vector noisyMeasurements = diff --git a/gtsam/basis/tests/testFourier.cpp b/gtsam/basis/tests/testFourier.cpp index 2995e8c454..9a46e066e8 100644 --- a/gtsam/basis/tests/testFourier.cpp +++ b/gtsam/basis/tests/testFourier.cpp @@ -22,6 +22,10 @@ #include #include +#if defined(__GNUC__) && !defined(__clang__) +#pragma GCC diagnostic warning "-Wstringop-overread" +#pragma GCC diagnostic warning "-Warray-bounds" +#endif using namespace std; using namespace gtsam; diff --git a/gtsam/geometry/BearingRange.h b/gtsam/geometry/BearingRange.h index 9c4e42edf8..9deb31b69e 100644 --- a/gtsam/geometry/BearingRange.h +++ b/gtsam/geometry/BearingRange.h @@ -138,8 +138,10 @@ struct BearingRange { TangentVector localCoordinates(const BearingRange& other) const { typename traits::TangentVector v1 = traits::Local(bearing_, other.bearing_); typename traits::TangentVector v2 = traits::Local(range_, other.range_); + // Set the first dimB elements to v1, and the next dimR elements to v2 TangentVector v; - v << v1, v2; + v.template head() = v1; + v.template tail() = v2; return v; } diff --git a/gtsam/geometry/FundamentalMatrix.cpp b/gtsam/geometry/FundamentalMatrix.cpp index 837ba72632..5c5e027155 100644 --- a/gtsam/geometry/FundamentalMatrix.cpp +++ b/gtsam/geometry/FundamentalMatrix.cpp @@ -9,6 +9,10 @@ #include #include +#if defined(__GNUC__) && !defined(__clang__) +#pragma GCC diagnostic ignored "-Wmaybe-uninitialized" +#endif + namespace gtsam { //************************************************************************* diff --git a/gtsam/slam/tests/testRotateFactor.cpp b/gtsam/slam/tests/testRotateFactor.cpp index 68e0de0f09..b748f83ed7 100644 --- a/gtsam/slam/tests/testRotateFactor.cpp +++ b/gtsam/slam/tests/testRotateFactor.cpp @@ -14,6 +14,9 @@ #include +#if defined(__GNUC__) && !defined(__clang__) +#pragma GCC diagnostic ignored "-Wmaybe-uninitialized" +#endif using namespace std; using namespace std::placeholders; using namespace gtsam;