From 6f40e8a5a86d2c97db46ec5e531fc97744737355 Mon Sep 17 00:00:00 2001 From: "Hans J. Johnson" Date: Wed, 29 Apr 2026 19:57:21 -0500 Subject: [PATCH] COMP: Use pzero() init for Packet locals in SelfadjointMatrixVector loop Follow-up to #6166. On ubuntu-24.04 + GCC 13/14 + C++20 (the toolchain that #6164 introduces), GCC -O3 IPA-CP emits additional false-positive -Wmaybe-uninitialized at the outer selfadjoint_product_impl::run() call site, attributing the read to "argument 3 of type const float *" of the cloned selfadjoint_matrix_vector_product::run.constprop.isra. Add pzero(Packet{}) declare-then-assign init for the four Packet locals (A0i, A1i, Bi, Xi) loaded from the lhs/rhs/res pointers inside the inner loop. Mirrors the #6166 ptmp2/ptmp3 pattern: pzero() is visible to GCC's IPA-CP as a definite zero starting state, while a bare declaration plus subsequent ploadu/pload is opaque and lets the optimizer trace an uninit path through cloned variants. --- .../src/Core/products/SelfadjointMatrixVector.h | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/Modules/ThirdParty/Eigen3/src/itkeigen/Eigen/src/Core/products/SelfadjointMatrixVector.h b/Modules/ThirdParty/Eigen3/src/itkeigen/Eigen/src/Core/products/SelfadjointMatrixVector.h index 6e3c0dc6fe0..912b579c576 100644 --- a/Modules/ThirdParty/Eigen3/src/itkeigen/Eigen/src/Core/products/SelfadjointMatrixVector.h +++ b/Modules/ThirdParty/Eigen3/src/itkeigen/Eigen/src/Core/products/SelfadjointMatrixVector.h @@ -112,13 +112,17 @@ selfadjoint_matrix_vector_product(a0It); + Packet A0i = pzero(Packet{}); + A0i = ploadu(a0It); a0It += PacketSize; - Packet A1i = ploadu(a1It); + Packet A1i = pzero(Packet{}); + A1i = ploadu(a1It); a1It += PacketSize; - Packet Bi = ploadu(rhsIt); + Packet Bi = pzero(Packet{}); + Bi = ploadu(rhsIt); rhsIt += PacketSize; // FIXME should be aligned in most cases - Packet Xi = pload(resIt); + Packet Xi = pzero(Packet{}); + Xi = pload(resIt); Xi = pcj0.pmadd(A0i, ptmp0, pcj0.pmadd(A1i, ptmp1, Xi)); ptmp2 = pcj1.pmadd(A0i, Bi, ptmp2);