Fix undefined behavior in matrix_cwise test for signed integers

Summary

  • Clamp std::numeric_limits<Scalar>::min() before cwiseAbs() for signed integer types
  • For int8_t, abs(-128) = 128 overflows back to -128, then cwiseSqrt(-128) is UB
  • Detected by clang UBSan on s390x, silent on x86

Test plan

  • matrix_cwise test suite passes
  • No UB with signed char min value

Closes #2933 (closed)

Merge request reports

Loading