[Bug c++/82801] New: Internal compiler error with Eigen and __attribute__((always_inline, flatten))

awllee at gmail dot com gcc-bugzilla@gcc.gnu.org
Wed Nov 1 23:32:00 GMT 2017


            Bug ID: 82801
           Summary: Internal compiler error with Eigen and
                    __attribute__((always_inline, flatten))
           Product: gcc
           Version: 7.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: awllee at gmail dot com
  Target Milestone: ---

Created attachment 42519
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=42519&action=edit
compressed compiler_error.ii

This internal compiler error involves a minimal call to the Eigen-3.3.4
template library. It works using clang and homebrewed GCC 7.2.0 on OSX, but
fails on Linux with GCC 7.2.0. It works using ICC on Linux.

Exact version of GCC: 7.2.0

System type: Linux, Ubuntu 16.04

GCC configure options: --enable-languages=c,c++ --disable-multilib

the complete command line that triggers the bug:
g++ -g -O1 -I/home/al17824/local/eigen-3.3.4 compiler_error.cpp -o

compiler output:
compiler_error.cpp:31:1: internal compiler error: Segmentation fault
0xb1272f crash_signal
0x1168f51 ipa_inline
0x1168f51 execute

preprocessed file attached.

Code is fairly simple; most changes lead to the compiler succeeding.

#include <Eigen/Core>
#include <iostream>

class A {
  virtual double bar() const = 0;

class B : public A {
  double bar() const;

__attribute__((always_inline, flatten))
inline double B::bar() const {
  Eigen::Matrix<double, 1, 1> v;
  return 0.0;

inline double foo(const B& c) {
  return c.bar();

void testError() {
  B model;
  std::cout << foo(model) << std::endl;

int main() {

More information about the Gcc-bugs mailing list