Version Info: Using built-in specs. Target: i486-linux-gnu Configured with: ../src/configure -v --enable-languages=c,c++,fortran,objc,obj-c++,treelang --prefix=/usr --enable-shared --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --enable-nls --with-gxx-include-dir=/usr/include/c++/4.2 --program-suffix=-4.2 --enable-clocale=gnu --enable-libstdcxx-debug --enable-objc-gc --enable-mpfr --enable-targets=all --enable-checking=release --build=i486-linux-gnu --host=i486-linux-gnu --target=i486-linux-gnu Thread model: posix gcc version 4.2.4 (Ubuntu 4.2.4-1ubuntu3)
Command line: g++ --save-temp snippet.cpp snippet.cpp:21: internal compiler error: Segmentation fault Please submit a full bug report, with preprocessed source if appropriate. See <URL:http://gcc.gnu.org/bugs.html> for instructions. For Debian GNU/Linux specific bug reporting instructions, see <URL:file:///usr/share/doc/gcc-4.2/README.Bugs>. --- SOURCE CODE BEGIN --- #include <stdlib.h> class MatrixBase { public: virtual ~MatrixBase() {} virtual const size_t M() const = 0 ; virtual const size_t N() const = 0 ; } ; template <class T, size_t M, size_t N> class Matrix : public MatrixBase { public: Matrix() {} ~Matrix() {} const double & operator()( size_t m, size_t n ) const { if ( m < M && n < N ) { return m_array[ m ][ n ] ; } else { throw Exception( "Matrix indices out of bounds" ) ; } } Matrix<T,M,N> & operator*=( double f ) { for ( size_t m = 0; m < M; ++m ) { for ( size_t n = 0; n < N; ++n ) { m_array[ m ][ n ] *= f ; } } return *this ; } const size_t M() const { return M ; } const size_t N() const { return N ; } typedef T size_type ; private: T m_array[ M ][ N ] ; } ; int main( int argc, char * argv[] ) { return 0 ; } --- SOURCE CODE END --- -- Summary: Segmentation fault g++ Product: gcc Version: 4.2.4 Status: UNCONFIRMED Severity: critical Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: stephanemarcotte at 3d-p dot com GCC target triplet: i486-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39797