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_CONSTEXPR to eliminate dead code paths where array[idx+1] accesses would exceed bounds
  • GCC 13 at -O3 generates false-positive -Warray-bounds warnings because it cannot prove the runtime guard prevents out-of-bounds access after constant propagation

Test plan

  • Tensor contraction compiles with -O3 -Warray-bounds -Werror on GCC 13
  • cxx11_tensor_contraction test suite passes

Closes #3017 (closed)

Merge request reports

Loading