This bugzilla service is closed. All entries have been migrated to https://gitlab.com/libeigen/eigen

Bug 1367

Summary: GCC 4.1.2 Compile Error
Product: Eigen Reporter: Joshua Warr <joshua.r.warr>
Component: GeneralAssignee: Nobody <eigen.nobody>
Status: RESOLVED FIXED    
Severity: Compilation Problem CC: chtz, gael.guennebaud, jacob.benoit.1, joshua.r.warr
Priority: Normal    
Version: 3.3 (current stable)   
Hardware: PPC - general   
OS: Other   
Whiteboard:

Description Joshua Warr 2016-12-20 17:36:52 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
#if EIGEN_GNUC_AT_LEAST(4,0)
#define EIGEN_ALWAYS_INLINE __attribute__((always_inline)) inline
#else
#define EIGEN_ALWAYS_INLINE EIGEN_STRONG_INLINE
#endif


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.
Comment 1 Gael Guennebaud 2016-12-20 21:15:01 UTC
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.
Comment 2 Gael Guennebaud 2016-12-20 21:19:05 UTC
https://bitbucket.org/eigen/eigen/commits/e5b9c7040bac/

backported to 3.3 and 3.2
Comment 3 Joshua Warr 2016-12-21 14:55:43 UTC
(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.
Comment 4 Nobody 2019-12-04 16:39:31 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to gitlab.com's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.com/libeigen/eigen/issues/1367.