Hello everybody, today, I noticed a bug in gcc 4.4.0. The compiler segfaulted during the compilation process. I also tested the same code with gcc 4.3.3, which works perfectly fine. I narrowed it down to the following test program:
------------------------------------------------ template <typename T> class test { private: int num_bins; public: void testing(void); }; template <typename T> void test<T>::testing(void) { double jackdata[this->num_bins]; } int main() { test<double> t; t.testing(); } ----------------------------------------------- The compilation command line is: g++ test.cc Error output: test.cc: In member function void test<T>::testing() [with T = double]: test.cc:17: instantiated from here test.cc:10: internal compiler error: Segmentation fault Please submit a full bug report, with preprocessed source if appropriate. See <http://gcc.gnu.org/bugs.html> for instructions. System information: gcc -v Using built-in specs. Target: x86_64-unknown-linux-gnu Configured with: ../configure --prefix=/usr --enable-shared --enable-languages=c,c++,fortran,objc,obj-c++ --enable-threads=posix --mandir=/usr/share/man --infodir=/usr/share/info --enable-__cxa_atexit --disable-multilib --libdir=/usr/lib --libexecdir=/usr/lib --enable-clocale=gnu --disable-libstdcxx-pch --with-tune=generic Thread model: posix gcc version 4.4.0 (GCC) If you need further information, please let me know. -- Summary: g++ segfaults compiling template code Product: gcc Version: 4.4.0 Status: UNCONFIRMED Severity: major Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: tux008 at googlemail dot com GCC build triplet: x86_64-unknown-linux-gnu GCC host triplet: x86_64-unknown-linux-gnu GCC target triplet: x86_64-unknown-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40260