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

2017-11-01 Thread awllee at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82801

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_error

compiler output:
compiler_error.cpp:31:1: internal compiler error: Segmentation fault
 }
 ^
0xb1272f crash_signal
/home/al17824/objdir/../gcc-7.2.0/gcc/toplev.c:337
0x1168f51 ipa_inline
/home/al17824/objdir/../gcc-7.2.0/gcc/ipa-inline.c:2422
0x1168f51 execute
/home/al17824/objdir/../gcc-7.2.0/gcc/ipa-inline.c:2845

preprocessed file attached.

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

#include 
#include 

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

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

__attribute__((always_inline, flatten))
inline double B::bar() const {
  Eigen::Matrix 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() {
  testError();
}

[Bug ipa/82801] Internal compiler error with Eigen and __attribute__((always_inline, flatten))

2017-11-01 Thread awllee at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82801

--- Comment #1 from Anthony Lee  ---
creduce reduces this to the below. However, I'm not sure this is the reason for
the original ICE since the error goes away if one writes inline double
B::m_fn1() const { ... }

template
class A {
public:
  A() {}
};

class B {
  double m_fn1() const;
};

__attribute__((always_inline, flatten))
double B::m_fn1() const {
  A<1> v;
  return 0.0;
}

int main() { }