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

Disable spurious gcc warning in xfunction::broadcast_shape #2816

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion include/xtensor/xfunction.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,7 @@ namespace xt

tuple_type m_e;
functor_type m_f;
mutable xfunction_cache<detail::promote_index<typename std::decay_t<CT>::shape_type...>> m_cache;
mutable xfunction_cache<detail::promote_index<typename std::decay_t<CT>::shape_type...>> m_cache{};

friend class xfunction_iterator<F, CT...>;
friend class xfunction_stepper<F, CT...>;
Expand Down Expand Up @@ -721,7 +721,13 @@ namespace xt
{
if (m_cache.is_initialized && reuse_cache)
{
// Disable spurious warning when copying into a 1-sized `std::array`
// in gcc >= 12.4.0; see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107852
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Warray-bounds"
#pragma GCC diagnostic ignored "-Wstringop-overflow"
std::copy(m_cache.shape.cbegin(), m_cache.shape.cend(), shape.begin());
#pragma GCC diagnostic pop
return m_cache.is_trivial;
}
else
Expand Down