http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53581

             Bug #: 53581
           Summary: Segmentation fault when enabling -std=c++0x on
                    template code
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: rgg...@gmail.com


Created attachment 27560
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=27560
The code that crashes gcc

When compiling the attached code like this:

g++ foo.cpp

then everything works fine. As soon as I enable c++0x:

g++ -std=c++0x foo.cpp

I get this error:
...
foo.cpp:36:7: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
...

-------------------------------------------------------

The full output of /usr/bin/g++ -v -std=c++0x foo.cpp

Using built-in specs.
COLLECT_GCC=/usr/bin/g++
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-unknown-linux-gnu/4.7.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: /build/src/gcc-4.7-20120505/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 --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 --with-fpmath=sse
Thread model: posix
gcc version 4.7.0 20120505 (prerelease) (GCC) 
COLLECT_GCC_OPTIONS='-v' '-std=c++11' '-shared-libgcc' '-mtune=generic'
'-march=x86-64'
 /usr/lib/gcc/x86_64-unknown-linux-gnu/4.7.0/cc1plus -quiet -v -D_GNU_SOURCE
foo.cpp -quiet -dumpbase foo.cpp -mtune=generic -march=x86-64 -auxbase foo
-std=c++11 -version -o /tmp/cc8d1FHu.s
GNU C++ (GCC) version 4.7.0 20120505 (prerelease) (x86_64-unknown-linux-gnu)
    compiled by GNU C version 4.7.0 20120505 (prerelease), GMP version 5.0.5,
MPFR version 3.1.0-p7, MPC version 0.9
warning: MPFR header version 3.1.0-p7 differs from library version 3.1.0-p10.
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
ignoring nonexistent directory
"/usr/lib/gcc/x86_64-unknown-linux-gnu/4.7.0/../../../../x86_64-unknown-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/lib/gcc/x86_64-unknown-linux-gnu/4.7.0/../../../../include/c++/4.7.0

/usr/lib/gcc/x86_64-unknown-linux-gnu/4.7.0/../../../../include/c++/4.7.0/x86_64-unknown-linux-gnu

/usr/lib/gcc/x86_64-unknown-linux-gnu/4.7.0/../../../../include/c++/4.7.0/backward
 /usr/lib/gcc/x86_64-unknown-linux-gnu/4.7.0/include
 /usr/local/include
 /usr/lib/gcc/x86_64-unknown-linux-gnu/4.7.0/include-fixed
 /usr/include
End of search list.
GNU C++ (GCC) version 4.7.0 20120505 (prerelease) (x86_64-unknown-linux-gnu)
    compiled by GNU C version 4.7.0 20120505 (prerelease), GMP version 5.0.5,
MPFR version 3.1.0-p7, MPC version 0.9
warning: MPFR header version 3.1.0-p7 differs from library version 3.1.0-p10.
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 06ee681e989ff71c2bb63d42d05c64ab
foo.cpp: In instantiation of ‘Child<A, M, N> Base<A, M, N>::operator-(const
Base<A, M, N>&) const [with A = float; int M = 3; int N = 3]’:
foo.cpp:30:65:   required from ‘bool Ops<A, N>::bar() const [with A = float;
int N = 3]’
foo.cpp:40:18:   required from here
foo.cpp:36:7: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <https://bugs.archlinux.org/> for instructions.

Reply via email to