Skip to content

Silence a warning about a memcpy overread for gcc 13#2002

Merged
dellaert merged 2 commits intoborglab:developfrom
jmackay2:gcc13_memcpy_warning
Feb 7, 2025
Merged

Silence a warning about a memcpy overread for gcc 13#2002
dellaert merged 2 commits intoborglab:developfrom
jmackay2:gcc13_memcpy_warning

Conversation

@jmackay2
Copy link
Copy Markdown
Contributor

This is the final fix to get gtsam building again on Ubuntu 24.04. I'm not super thrilled just ignoring this warning. This could probably use a revisit on ways to fix the issue.

Here is the error this is fixing:

    inlined from ‘void Eigen::internal::call_assignment(Dst&, const Src&) [with Dst = Eigen::Block<Eigen::Matrix<double, -1, -1>, -1, -1, false>; Src = Eigen::Matrix<double, -1, -1>]’ at gtsam/gtsam/3rdparty/Eigen/Eigen/src/Core/AssignEvaluator.h:836:18,
    inlined from ‘Derived& Eigen::MatrixBase<Derived>::operator=(const Eigen::DenseBase<OtherDerived>&) [with OtherDerived = Eigen::Matrix<double, -1, -1>; Derived = Eigen::Block<Eigen::Matrix<double, -1, -1>, -1, -1, false>]’ at gtsam/gtsam/3rdparty/Eigen/Eigen/src/Core/Assign.h:66:28,
    inlined from ‘void gtsam::JacobianFactor::fillTerms(const TERMS&, const gtsam::Vector&, const gtsam::SharedDiagonal&) [with TERMS = std::map<long unsigned int, Eigen::Matrix<double, 1, 1, 0, 1, 1> >]’ at gtsam/gtsam/linear/JacobianFactor-inl.h:94:14:
/usr/lib/gcc/x86_64-linux-gnu/13/include/emmintrin.h:169:19: error: ‘void* __builtin_memcpy(void*, const void*, long unsigned int)’ reading 16 or more bytes from a region of size 8 [-Werror=stringop-overread]
  169 |   *(__m128d *)__P = __A;
      |   ~~~~~~~~~~~~~~~~^~~~~

This seems to be pointing to this assignment:

This fix is based on the same solution used in #1978 .

I am able to get a successful Ubuntu 24.04 build after this fix.

@dellaert
Copy link
Copy Markdown
Member

CI issue?

@ProfFan
Copy link
Copy Markdown
Collaborator

ProfFan commented Jan 25, 2025

Need to guard against older GCC:
error: unknown option after ‘#pragma GCC diagnostic’ kind [-Werror=pragmas]

@dellaert
Copy link
Copy Markdown
Member

dellaert commented Feb 7, 2025

Ping @jmackay2

Copy link
Copy Markdown
Member

@dellaert dellaert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!!!!

@dellaert dellaert merged commit 885e8ef into borglab:develop Feb 7, 2025
@jmackay2 jmackay2 deleted the gcc13_memcpy_warning branch March 20, 2025 02:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants