From 93fd3ac1c16b0b5b7d0c18c36eecbefb32f50ee5 Mon Sep 17 00:00:00 2001 From: Loic Gouarin Date: Thu, 29 Oct 2026 18:50:04 +0100 Subject: [PATCH] Initialize the operand of the xfixed buffer_adaptor test The xtensor_fixed.buffer_adaptor test multiplied an adapted row by a default constructed xtensor_fixed. Like std::array, xtensor_fixed does not initialize its elements, so the test read indeterminate values and checked nothing. GCC 13 at -O3 reports the read as -Wmaybe-uninitialized in the multiplies operator, and in xcontainer::load_simd when XTENSOR_USE_XSIMD is defined. The operand is now initialized, the buffer starts at ones so the product is visible, and the test checks the result. --- test/test_xfixed.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/test/test_xfixed.cpp b/test/test_xfixed.cpp index 3a6e8181b..02c5b2968 100644 --- a/test/test_xfixed.cpp +++ b/test/test_xfixed.cpp @@ -172,10 +172,12 @@ namespace xt TEST(xtensor_fixed, buffer_adaptor) { - xtensor_fixed> a; - xtensor b = zeros({3, 3}); + xtensor_fixed> a = {1., 2., 3.}; + xtensor b = ones({3, 3}); auto c = adapt(&b(0, 0), xshape<3>()); c *= a; + xtensor expected = {{1., 2., 3.}, {1., 1., 1.}, {1., 1., 1.}}; + EXPECT_EQ(b, expected); } TEST(xtensor_fixed, layout)