http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54431
Bug #: 54431
Summary: [C++11] g++ crashes when compiling the following file
Classification: Unclassified
Product: gcc
Version: 4.7.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: [email protected]
ReportedBy: [email protected]
$ cat y.cpp
template <class>
struct foo
{
public:
void bar()
{
[this]{bar();}();
}
};
int main()
{
foo<int> ss;
ss.bar();
}
$ g++ -v -save-temps -std=c++11 y.cpp
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-unknown-linux-gnu/4.7.1/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: /build/src/gcc-4.7-20120721/configure --prefix=/usr
--libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man
--infodir=/usr/share/info --with-bugurl=https://bugs.archlinux.org/
--enable-languages=c,c++,ada,fortran,go,lto,objc,obj-c++ --enable-shared
--enable-threads=posix --with-system-zlib --enable-__cxa_atexit
--disable-libunwind-exceptions --enable-clocale=gnu --disable-libstdcxx-pch
--enable-libstdcxx-time --enable-gnu-unique-object --enable-linker-build-id
--with-ppl --enable-cloog-backend=isl --disable-ppl-version-check
--disable-cloog-version-check --enable-lto --enable-gold --enable-ld=default
--enable-plugin --with-plugin-ld=ld.gold --with-linker-hash-style=gnu
--enable-multilib --disable-libssp --disable-build-with-cxx
--disable-build-poststage1-with-cxx --enable-checking=release
Thread model: posix
gcc version 4.7.1 20120721 (prerelease) (GCC)
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-std=c++11' '-shared-libgcc'
'-mtune=generic' '-march=x86-64'
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.7.1/cc1plus -E -quiet -v -D_GNU_SOURCE
y.cpp -mtune=generic -march=x86-64 -std=c++11 -fpch-preprocess -o y.ii
ignoring nonexistent directory
"/usr/lib/gcc/x86_64-unknown-linux-gnu/4.7.1/../../../../x86_64-unknown-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.7.1/../../../../include/c++/4.7.1
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.7.1/../../../../include/c++/4.7.1/x86_64-unknown-linux-gnu
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.7.1/../../../../include/c++/4.7.1/backward
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.7.1/include
/usr/local/include
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.7.1/include-fixed
/usr/include
End of search list.
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-std=c++11' '-shared-libgcc'
'-mtune=generic' '-march=x86-64'
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.7.1/cc1plus -fpreprocessed y.ii -quiet
-dumpbase y.cpp -mtune=generic -march=x86-64 -auxbase y -std=c++11 -version -o
y.s
GNU C++ (GCC) version 4.7.1 20120721 (prerelease) (x86_64-unknown-linux-gnu)
compiled by GNU C version 4.7.1 20120721 (prerelease), GMP version 5.0.5,
MPFR version 3.1.1, MPC version 1.0
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
GNU C++ (GCC) version 4.7.1 20120721 (prerelease) (x86_64-unknown-linux-gnu)
compiled by GNU C version 4.7.1 20120721 (prerelease), GMP version 5.0.5,
MPFR version 3.1.1, MPC version 1.0
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 8466381cd327359656bc3ec3a9c33398
y.cpp: In lambda function:
y.cpp:15:1: internal compiler error: in get_expr_operands, at
tree-ssa-operands.c:1035
Please submit a full bug report,
with preprocessed source if appropriate.
See <https://bugs.archlinux.org/> for instructions.
$ cat y.ii
# 1 "y.cpp"
# 1 "<command-line>"
# 1 "y.cpp"
template <class>
struct foo
{
public:
void bar()
{
[this]{bar();}();
}
};
int main()
{
foo<int> ss;
ss.bar();
}
Gcc doesn't crash if foo is not a templated class.