AsFem
AsFem copied to clipboard
gcc11 compile error
When compiling with gcc11.2.0, the following error occurs:
In file included from /home/by/Projects/GitHub/AsFem/external/eigen/Eigen/Core:330,
from /home/by/Projects/GitHub/AsFem/external/eigen/Eigen/Dense:1,
from /home/by/Projects/GitHub/AsFem/external/eigen/Eigen/Eigen:1,
from /home/by/Projects/GitHub/AsFem/src/Utils/MathUtils/RankTwoTensor.cpp:17:
/home/by/Projects/GitHub/AsFem/external/eigen/Eigen/src/Core/products/TriangularMatrixVector.h: In static member function ‘static void Eigen::internal::trmv_selector<Mode, 1>::run(const Lhs&, const Rhs&, Dest&, const typename Dest::Scalar&) [with Lhs = Eigen::Transpose<const Eigen::Block<const Eigen::Block<Eigen::Matrix<double, 3, 3>, -1, -1, false>, -1, -1, false> >; Rhs = Eigen::Transpose<const Eigen::CwiseBinaryOp<Eigen::internal::scalar_product_op<double, double>, const Eigen::CwiseNullaryOp<Eigen::internal::scalar_constant_op<double>, const Eigen::Matrix<double, 1, -1, 1, 1, 3> >, const Eigen::Transpose<const Eigen::Block<const Eigen::Block<const Eigen::Block<Eigen::Matrix<double, 3, 3>, -1, -1, false>, -1, 1, true>, -1, 1, false> > > >; Dest = Eigen::Transpose<Eigen::Block<Eigen::Block<Eigen::Matrix<double, -1, -1, 1, -1, -1>, 1, -1, true>, 1, -1, false> >; int Mode = 6]’:
/home/by/Projects/GitHub/AsFem/external/eigen/Eigen/src/Core/products/TriangularMatrixVector.h:332:12: error: ‘result’ may be used uninitialized [-Werror=maybe-uninitialized]
327 | internal::triangular_matrix_vector_product
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
328 | <Index,Mode,
| ~~~~~~~~~~~~
329 | LhsScalar, LhsBlasTraits::NeedToConjugate,
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
330 | RhsScalar, RhsBlasTraits::NeedToConjugate,
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
331 | RowMajor>
| ~~~~~~~~~
332 | ::run(actualLhs.rows(),actualLhs.cols(),
| ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
333 | actualLhs.data(),actualLhs.outerStride(),
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
334 | actualRhsPtr,1,
| ~~~~~~~~~~~~~~~
335 | dest.data(),dest.innerStride(),
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
336 | actualAlpha);
| ~~~~~~~~~~~~
/home/by/Projects/GitHub/AsFem/external/eigen/Eigen/src/Core/products/TriangularMatrixVector.h:105:24: note: by argument 5 of type ‘const double*’ to ‘static void Eigen::internal::triangular_matrix_vector_product<Index, Mode, LhsScalar, ConjLhs, RhsScalar, ConjRhs, 1, Version>::run(Index, Index, const LhsScalar*, Index, const RhsScalar*, Index, Eigen::internal::triangular_matrix_vector_product<Index, Mode, LhsScalar, ConjLhs, RhsScalar, ConjRhs, 1, Version>::ResScalar*, Index, const ResScalar&) [with Index = long int; int Mode = 6; LhsScalar = double; bool ConjLhs = false; RhsScalar = double; bool ConjRhs = false; int Version = 0]’ declared here
105 | EIGEN_DONT_INLINE void triangular_matrix_vector_product<Index,Mode,LhsScalar,ConjLhs,RhsScalar,ConjRhs,RowMajor,Version>
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[ 14%] Building CXX object CMakeFiles/asfem.dir/src/InputSystem/PostprocessBlockReader.cpp.o
This issue is reported here: https://gitlab.com/libeigen/eigen/-/issues/2304
This issue can be resolved by adding *reinterpret_cast<unsigned char*>(actualRhsPtr) = 0
after actualRhsPtr
. Otherwise, one should use -DCMAKE_BUILD_TYPE=Release
.