Description of Problem: This short C++ fragment causes gcc 2.96-98 to print "Internal error: Floating point exception" when compiled with -O2 (no FPE with -O0). (yes, I know this code won't work correctly even if it did compile...) I've seen other floating point exception bugs in Bugzilla, but they were all for earlier versions of gcc, and marked CLOSED. Steps to Reproduce: 1. g++ bugcase.cpp -c -O2 // bugcase.cpp template<class T> class MyArray { public: T* p; int nused; void append(T foo) { p[nused++] = foo; } }; typedef float v3_t[3]; void test(v3_t v) { MyArray<v3_t> a; a.append(v); }
As of gcc 3.2, we issue the diagnostic z.c: In member function `void MyArray<T>::append(T) [with T=float[3]]': z.c:20: instantiated from here z.c:11: ISO C++ forbids assignment of arrays which is probably what we were trying to do beforehand, and got confused.