Skip to content

Commit

Permalink
gtests: graph: workaround gcc compilation issue
Browse files Browse the repository at this point in the history
Wrap a single function to avoid warning removal for the whole library
since only a single test is affected.
  • Loading branch information
dzarukin authored and mgouicem committed Dec 4, 2024
1 parent c805a50 commit 7d3164d
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions tests/gtests/graph/unit/backend/dnnl/dnnl_test_common.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -235,13 +235,27 @@ static inline bool allclose(const std::vector<T> &a, const std::vector<T> &b,
return flag;
}

// For some unknown reason, GCC 14.x (but to be precautios, 11.x is guarded) and
// beyond can't compile this specific function.
#if defined(__GNUC__) && __GNUC__ > 10 && !defined(__clang__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wfree-nonheap-object"
// new_allocator.h:172:33: warning: ‘void operator delete(void*)’ called on
// pointer ‘<unknown>’ with nonzero offset [1, 9223372036854775807]
// [-Wfree-nonheap-object]
// 172 | _GLIBCXX_OPERATOR_DELETE(_GLIBCXX_SIZED_DEALLOC(__p, __n));
// | ^
#endif
template <typename T>
static inline bool allclose(
const test_tensor &a, const test_tensor &b, float rtol, float atol) {
auto av = a.as_vec_type<T>();
auto bv = b.as_vec_type<T>();
return allclose(av, bv, rtol, atol);
}
#if defined(__GNUC__) && __GNUC__ > 10 && !defined(__clang__)
#pragma GCC diagnostic pop
#endif

static inline size_t product(std::vector<int64_t> &in) {
if (in.empty()) return 0;
Expand Down

0 comments on commit 7d3164d

Please sign in to comment.