Fix GCC 13 array-bounds warning in TensorContraction
Summary
- Value-initialize stride arrays (
m_i_strides,m_j_strides,m_k_strides, etc.) to zero - Use
EIGEN_IF_CONSTEXPRto eliminate dead code paths wherearray[idx+1]accesses would exceed bounds - GCC 13 at
-O3generates false-positive-Warray-boundswarnings because it cannot prove the runtime guard prevents out-of-bounds access after constant propagation
Test plan
-
Tensor contraction compiles with
-O3 -Warray-bounds -Werroron GCC 13 -
cxx11_tensor_contractiontest suite passes
Closes #3017 (closed)