I ran across the following while compiling a C++ source of mine: borked.cpp: In function 'void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator<triple<long long int, long long int, double>*, std::vector<triple<long long int, long long int, double>, std::allocator<triple<long long int, long long int, double> > > >, _Size = int, _Compare = bool (*)(mm_entry_t, mm_entry_t)]': borked.cpp:51: internal compiler error: Segmentation fault Please submit a full bug report, with preprocessed source if appropriate.
I have reduced the source code as much as possible and pasted it below (I couldn't see a way to make an attachment). I haven't preprocessed it, but the only headers involved are standard C++ headers, and there are no complicated #defines. I invoked the compiler as: g++ -c -fipa-pta -o bork.o borked.cpp If I drop -fipa-pta, everything works. My compiler version is: gcc (Gentoo 4.3.1-r1 p1.1) 4.3.1 (I was not sure whether to file a report with Gentoo or here. I chose here as I doubt Gentoo have fiddled with the implementation of -fipa-pta. Apologies if I guessed wrong.) --------------------------- Source: --------------------------- #include <vector> #include <stdint.h> #include <algorithm> template< class T1, class T2, class T3 > class triple{ public: T1 first; T2 second; T3 third; triple() : first(), second(), third() {} triple( T1 a, T2 b, T3 c ) : first(a), second(b), third(c) {} }; typedef int64_t sindex_t; typedef uint64_t entry_t; typedef double value_t; typedef triple<sindex_t, sindex_t, value_t> mm_entry_t; typedef triple<sindex_t, sindex_t, sindex_t > mm_size_t; typedef std::vector< mm_entry_t > mm_entries_t; typedef std::pair< mm_size_t, mm_entries_t > mm_matrix_t; #define get_row( entry ) (entry).first #define get_col( entry ) (entry).second bool compare( mm_entry_t a, mm_entry_t b ){ if ( get_row(a) < get_row(b) ) return true; if ( get_row(a) > get_row(b) ) return false; if ( get_col(a) < get_col(b) ) return true; return false; } int main( int argc, char* argv[] ){ mm_matrix_t matrix; std::sort( matrix.second.begin(), matrix.second.end(), compare ); return 0; } -- Summary: g++ 4.3.1 ICE with -fipa-pta Product: gcc Version: 4.3.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: warren dot armstrong at anu dot edu dot au GCC build triplet: --build=i686-pc-linux-gnu GCC host triplet: --host=i686-pc-linux-gnu GCC target triplet: Same as host http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39014