http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52385
Bug #: 52385
Summary: [C++0x][constexpr] Segfault in constexpr
Classification: Unclassified
Product: gcc
Version: 4.6.0
Status: UNCONFIRMED
Severity: critical
Priority: P3
Component: c++
AssignedTo: [email protected]
ReportedBy: [email protected]
Created attachment 26754
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=26754
preprocessed file
Compiling the following programm (.ii file is attached) with "g++ -g
-std=c++0x" crashes:
constexpr int minus(int x, int y, int j1 = 0, int j2 = 0) {
return j1 == x - y ? j1 : (j2 == x - y ? j2 : minus(x, y, j1 + 1, j2 - 1));
}
int main() {
constexpr int result = minus(290321321, 31721711);
return result;
}
Output:
g++ -g -std=c++0x -o main main.cpp
g++: internal compiler error: Segmentation fault (program cc1plus)
...
gcc -v
Using built-in specs.
COLLECT_GCC=/opt/gcc/bin/gcc
COLLECT_LTO_WRAPPER=/opt/gcc-4.6.0/libexec/gcc/x86_64-unknown-linux-gnu/4.6.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ./configure --prefix=/opt/gcc-4.6.0
Thread model: posix
gcc version 4.6.0 (GCC)
uname -a
Linux terra-ubuntu-vm 2.6.38-13-generic #54-Ubuntu SMP Tue Jan 3 13:38:12 UTC
2012 x86_64 x86_64 x86_64 GNU/Linux