Bugzilla – Bug 1367
GCC 4.1.2 Compile Error
Last modified: 2016-12-21 14:55:43 UTC
I am seeing a compile error with a VxWorks distribution of GCC 4.1.2. I am cross-compiling: the host is Linux x86_64, the target is VxWorks PPC604. This issue only occurs when I use the -O2 compile flag. I am getting the following compile error:
/home/advtech1/jwarr/kkass/git/hera/build/dependencies/eigen-3.2.5/eigen-3.2.5/include/eigen3/Eigen/src/Core/products/GeneralBlockPanelKernel.h:119: sorry, unimplemented: inlining failed in call to 'static void Eigen::internal::gebp_madd_selector<CJ, T, T, T, T>::run(const CJ&, T&, T&, T&, T&) [with CJ = Eigen::internal::conj_helper<double, double, false, false>, T = double]': function not considered for inlining
The culprit is the EIGEN_ALWAYS_INLINE macro. In <src/core/util/Macros.h>, there is a fix/hack for this compile problem for GCC versions prior to 4.0:
// FIXME with the always_inline attribute,
// gcc 3.4.x reports the following compilation error:
// Eval.h:91: sorry, unimplemented: inlining failed in call to 'const Eigen::Eval<Derived> Eigen::MatrixBase<Scalar, Derived>::eval() const'
// : function body not available
#define EIGEN_ALWAYS_INLINE __attribute__((always_inline)) inline
#define EIGEN_ALWAYS_INLINE EIGEN_STRONG_INLINE
However, I am seeing the noted compile error with GCC 4.1.2. Looks like the GCC minimum version for using the always_inline attribute needs to be 4.2 (or possibly higher?). If I make that change (I changed #if EIGEN_GNUC_AT_LEAST(4,0) to #if EIGEN_GNUC_AT_LEAST(4,2) ), my compile succeeds.
Cannot you update to a newer compiler? gcc 4.1 produces pretty bad code with advanced C++ as in Eigen, and we don't aim at supporting such old versions of gcc. Anyway, if this change is all you need, I'll happily apply it.
backported to 3.3 and 3.2
(In reply to Gael Guennebaud from comment #1)
> Cannot you update to a newer compiler? gcc 4.1 produces pretty bad code with
> advanced C++ as in Eigen, and we don't aim at supporting such old versions
> of gcc. Anyway, if this change is all you need, I'll happily apply it.
We have constraints on some legacy products require us to use certain tool sets. Thank you for addressing this issue.