Skip to content
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

ClangTidy clang-analyzer-core.uninitialized.Assign error in RCP #2048

Open
oliverlee opened this issue Sep 17, 2024 · 0 comments
Open

ClangTidy clang-analyzer-core.uninitialized.Assign error in RCP #2048

oliverlee opened this issue Sep 17, 2024 · 0 comments

Comments

@oliverlee
Copy link

When running symengine in aarch64-darwin, ClangTidy 18, and with defines WITH_SYMENGINE_RCP and WITH_SYMENGINE_THREADSAFE, I'm getting an error from the move constructor:

external/symengine/symengine/symengine_rcp.h:129:48: error: Assigned value is garbage or undefined [clang-analyzer-core.uninitialized.Assign,-warnings-as-errors]
  129 |     RCP(RCP<T> &&rp) SYMENGINE_NOEXCEPT : ptr_(rp.ptr_)

trimmed backtrace:

./rigid_geometric_algebra/blade.hpp:35:12: note: Calling move constructor for 'Expression'
   35 |     return std::forward<Self>(self).coefficient;
      |            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
external/symengine/symengine/expression.h:75:11: note: Calling move constructor for 'RCP<const SymEngine::Basic>'
   75 |         : m_basic(std::move(other.m_basic))
      |           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
external/symengine/symengine/symengine_rcp.h:129:48: note: Assigned value is garbage or undefined
  129 |     RCP(RCP<T> &&rp) SYMENGINE_NOEXCEPT : ptr_(rp.ptr_)
      |                                                ^~~~~~~

This error is still triggered if the higher level value (self) is cast to const (so this check still triggers in the copy constructor).

Some searches online seem to suggest there may be false positives with this check. Deleting the move constructor, such that the converting move constructor is called instead, does not trigger this check. I did not run into any issues when running this test with ASAN.

Functionally, I assume RCP is an implementation of shared_ptr although the location of the control block seems different.

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

No branches or pull requests

1 participant