From 6e7abeae69eafe8d36043ece26a8796ca168fd21 Mon Sep 17 00:00:00 2001 From: Charles Schlosser Date: Mon, 17 Jul 2023 20:37:27 +0000 Subject: [PATCH] fix arm build warnings --- test/array_cwise.cpp | 30 +++++++++---------- test/numext.cpp | 6 ++-- .../CXX11/src/Tensor/TensorContraction.h | 8 ++--- .../Eigen/CXX11/src/Tensor/TensorDimensions.h | 2 +- 4 files changed, 23 insertions(+), 23 deletions(-) diff --git a/test/array_cwise.cpp b/test/array_cwise.cpp index 1df9e1d5b..d06fa2c70 100644 --- a/test/array_cwise.cpp +++ b/test/array_cwise.cpp @@ -87,21 +87,21 @@ void special_value_pairs(Array& x, template void binary_op_test(std::string name, Fn fun, RefFn ref) { const Scalar tol = test_precision(); - Array x; - Array y; - special_value_pairs(x, y); + Array lhs; + Array rhs; + special_value_pairs(lhs, rhs); - Array actual = fun(x, y); + Array actual = fun(lhs, rhs); bool all_pass = true; - for (Index i = 0; i < x.rows(); ++i) { - for (Index j = 0; j < x.cols(); ++j) { - Scalar e = static_cast(ref(x(i,j), y(i,j))); + for (Index i = 0; i < lhs.rows(); ++i) { + for (Index j = 0; j < lhs.cols(); ++j) { + Scalar e = static_cast(ref(lhs(i,j), rhs(i,j))); Scalar a = actual(i, j); bool success = (a==e) || ((numext::isfinite)(e) && internal::isApprox(a, e, tol)) || ((numext::isnan)(a) && (numext::isnan)(e)); if ((a == a) && (e == e)) success &= (bool)numext::signbit(e) == (bool)numext::signbit(a); all_pass &= success; if (!success) { - std::cout << name << "(" << x(i,j) << "," << y(i,j) << ") = " << a << " != " << e << std::endl; + std::cout << name << "(" << lhs(i,j) << "," << rhs(i,j) << ") = " << a << " != " << e << std::endl; } } } @@ -139,27 +139,27 @@ template void unary_op_test(std::string name, Fn fun, RefFn ref) { const Scalar tol = test_precision(); auto values = special_values(); - Map> x(values.data(), values.size()); + Map> valuesMap(values.data(), values.size()); - Array actual = fun(x); + Array actual = fun(valuesMap); bool all_pass = true; - for (Index i = 0; i < x.size(); ++i) { - Scalar e = static_cast(ref(x(i))); + for (Index i = 0; i < valuesMap.size(); ++i) { + Scalar e = static_cast(ref(valuesMap(i))); Scalar a = actual(i); bool success = (a == e) || ((numext::isfinite)(e) && internal::isApprox(a, e, tol)) || ((numext::isnan)(a) && (numext::isnan)(e)); if ((a == a) && (e == e)) success &= (bool)numext::signbit(e) == (bool)numext::signbit(a); all_pass &= success; if (!success) { - std::cout << name << "(" << x(i) << ") = " << a << " != " << e << std::endl; + std::cout << name << "(" << valuesMap(i) << ") = " << a << " != " << e << std::endl; } } VERIFY(all_pass); } #define UNARY_FUNCTOR_TEST_ARGS(fun) #fun, \ - [](const auto& x) { return (Eigen::fun)(x); }, \ - [](const auto& x) { return (std::fun)(x); } + [](const auto& x_) { return (Eigen::fun)(x_); }, \ + [](const auto& y_) { return (std::fun)(y_); } template void unary_ops_test() { diff --git a/test/numext.cpp b/test/numext.cpp index e99eddc2f..cca041152 100644 --- a/test/numext.cpp +++ b/test/numext.cpp @@ -286,9 +286,9 @@ struct check_signbit_impl { return all_pass; }; - bool all_pass = check_all(non_negative_values, false_mask); - all_pass = all_pass && check_all(negative_values, (NumTraits::IsSigned ? true_mask : false_mask)); - VERIFY(all_pass); + bool check_all_pass = check_all(non_negative_values, false_mask); + check_all_pass = check_all_pass && check_all(negative_values, (NumTraits::IsSigned ? true_mask : false_mask)); + VERIFY(check_all_pass); } }; template diff --git a/unsupported/Eigen/CXX11/src/Tensor/TensorContraction.h b/unsupported/Eigen/CXX11/src/Tensor/TensorContraction.h index 55369e188..2fa6777b2 100644 --- a/unsupported/Eigen/CXX11/src/Tensor/TensorContraction.h +++ b/unsupported/Eigen/CXX11/src/Tensor/TensorContraction.h @@ -91,8 +91,8 @@ struct TensorContractionBlockMemAllocator { eigen_assert(rhs_block); BlockSizes sz = ComputeLhsRhsBlockSizes(bm, bk, bn); char* block_mem = static_cast(d.allocate(sz.lhs_size + sz.rhs_size)); - *lhs_block = reinterpret_cast(block_mem); - *rhs_block = reinterpret_cast(block_mem + sz.lhs_size); + *lhs_block = static_cast(static_cast(block_mem)); + *rhs_block = static_cast(static_cast(block_mem + sz.lhs_size)); return block_mem; } @@ -115,12 +115,12 @@ struct TensorContractionBlockMemAllocator { for (Index x = 0; x < num_slices; x++) { if (num_lhs > 0) lhs_blocks[x].resize(num_lhs); for (Index m = 0; m < num_lhs; m++) { - lhs_blocks[x][m] = reinterpret_cast(mem); + lhs_blocks[x][m] = static_cast(static_cast(mem)); mem += sz.lhs_size; } if (num_rhs > 0) rhs_blocks[x].resize(num_rhs); for (Index n = 0; n < num_rhs; n++) { - rhs_blocks[x][n] = reinterpret_cast(mem); + rhs_blocks[x][n] = static_cast(static_cast(mem)); mem += sz.rhs_size; } } diff --git a/unsupported/Eigen/CXX11/src/Tensor/TensorDimensions.h b/unsupported/Eigen/CXX11/src/Tensor/TensorDimensions.h index 6d9e9dc23..914140dea 100644 --- a/unsupported/Eigen/CXX11/src/Tensor/TensorDimensions.h +++ b/unsupported/Eigen/CXX11/src/Tensor/TensorDimensions.h @@ -423,7 +423,7 @@ struct sizes_match_below_dim { template struct sizes_match_below_dim { static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE bool run(Dims1& dims1, Dims2& dims2) { - return (array_get(dims1) == array_get(dims2)) && + return numext::equal_strict(array_get(dims1), array_get(dims2)) && sizes_match_below_dim::run(dims1, dims2); } };