Core: Fix clang warnings in the Concat evaluator and TensorAssign libeigen/eigen!2986 Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
diff --git a/Eigen/src/Core/ConcatOp.h b/Eigen/src/Core/ConcatOp.h index 91296a6..4ba1cc6 100644 --- a/Eigen/src/Core/ConcatOp.h +++ b/Eigen/src/Core/ConcatOp.h
@@ -165,7 +165,7 @@ LhsOrderAgrees = (bool(int(LhsFlags) & RowMajorBit) == bool(IsRowMajor)) || LhsNestedCleaned::IsVectorAtCompileTime, RhsOrderAgrees = (bool(int(RhsFlags) & RowMajorBit) == bool(IsRowMajor)) || RhsNestedCleaned::IsVectorAtCompileTime, BothHavePacketAccess = (int(LhsFlags) & int(RhsFlags) & PacketAccessBit) && LhsOrderAgrees && RhsOrderAgrees, - BothHaveLinearAccess = int(LhsFlags) & int(RhsFlags) & LinearAccessBit, + BothHaveLinearAccess = bool(int(LhsFlags) & int(RhsFlags) & LinearAccessBit), Flags = (traits<XprType>::Flags & RowMajorBit) | (BothHavePacketAccess ? PacketAccessBit : 0) | (IsVectorAtCompileTime && BothHaveLinearAccess ? LinearAccessBit : 0), Alignment = 0 // conservative: no alignment guarantees across boundary
diff --git a/unsupported/Eigen/src/Tensor/TensorAssign.h b/unsupported/Eigen/src/Tensor/TensorAssign.h index 36d991b..0093c24 100644 --- a/unsupported/Eigen/src/Tensor/TensorAssign.h +++ b/unsupported/Eigen/src/Tensor/TensorAssign.h
@@ -79,6 +79,8 @@ struct TensorEvaluator<const TensorAssignOp<LeftArgType, RightArgType>, Device> { typedef TensorAssignOp<LeftArgType, RightArgType> XprType; typedef typename XprType::Index Index; + using LeftIndex = typename TensorEvaluator<LeftArgType, Device>::Index; + using RightIndex = typename TensorEvaluator<RightArgType, Device>::Index; typedef typename XprType::Scalar Scalar; typedef typename XprType::CoeffReturnType CoeffReturnType; typedef typename PacketType<CoeffReturnType, Device>::type PacketReturnType; @@ -148,17 +150,22 @@ } EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void evalScalar(Index i) const { - m_leftImpl.coeffRef(i) = m_rightImpl.coeff(i); + m_leftImpl.coeffRef(internal::convert_index<LeftIndex>(i)) = + m_rightImpl.coeff(internal::convert_index<RightIndex>(i)); } EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void evalPacket(Index i) const { constexpr int LhsStoreMode = TensorEvaluator<LeftArgType, Device>::IsAligned ? Aligned : Unaligned; constexpr int RhsLoadMode = TensorEvaluator<RightArgType, Device>::IsAligned ? Aligned : Unaligned; - m_leftImpl.template writePacket<LhsStoreMode>(i, m_rightImpl.template packet<RhsLoadMode>(i)); + m_leftImpl.template writePacket<LhsStoreMode>( + internal::convert_index<LeftIndex>(i), + m_rightImpl.template packet<RhsLoadMode>(internal::convert_index<RightIndex>(i))); } - EIGEN_DEVICE_FUNC CoeffReturnType coeff(Index index) const { return m_leftImpl.coeff(index); } + EIGEN_DEVICE_FUNC CoeffReturnType coeff(Index index) const { + return m_leftImpl.coeff(internal::convert_index<LeftIndex>(index)); + } template <int LoadMode> EIGEN_DEVICE_FUNC PacketReturnType packet(Index index) const { - return m_leftImpl.template packet<LoadMode>(index); + return m_leftImpl.template packet<LoadMode>(internal::convert_index<LeftIndex>(index)); } EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE TensorOpCost costPerCoeff(bool vectorized) const {