I get the error message bug.cpp:16: internal compiler error: in create_tmp_var, at gimplify.c:487 when compiling the following code with g++ -fopenmp -DTVMET_OPTIMIZE -c bug.cpp where bug.cpp contains: #include <tvmet/Vector.h> // Tiny Vector Matrix library using Expression Templates #include <tvmet/VectorFunctions.h> // http://tvmet.sourceforge.net/ using namespace tvmet; int main() { Vector<int,3> a[10]; int i; #pragma omp parallel { #pragma omp for schedule(dynamic) for (i=0; i<10; ++i) { // do something } #pragma omp master { a[0] = a[1]; } #pragma omp for schedule(dynamic) for (i=0; i<10; ++i) { // do something } } } The problem is definitely related to openmp because the following code compiles without any error: #include <tvmet/Vector.h> // Tiny Vector Matrix library using Expression Templates #include <tvmet/VectorFunctions.h> // http://tvmet.sourceforge.net/ using namespace tvmet; int main() { Vector<int,3> a[10]; int i; #pragma omp parallel for schedule(dynamic) for (i=0; i<10; ++i) { // do something } a[0] = a[1]; #pragma omp parallel for schedule(dynamic) for (i=0; i<10; ++i) { // do something } }
Can you try to come up with an example that is self-contained, i.e. only contains those parts of the Tiny Vector Matrix library that are really used (or none at all)? W.
Here is a self-contained example: template<class T, int Sz> class Vector { public: explicit Vector() {} ~Vector() {} private: T m_data[Sz]; }; int main() { Vector<int,3> a[10]; int i; #pragma omp parallel { #pragma omp for schedule(dynamic) for (i=0; i<10; ++i) { // do something } #pragma omp master { a[0] = a[1]; } #pragma omp for schedule(dynamic) for (i=0; i<10; ++i) { // do something } } } I can avoid the internal compiler error by: 1) removing the '-fopenmp' option 2) changing the '#pragma omp' statements as shown in the original example 3) removing the destructor '~Vector() {}' from 'class Vector' in the new example!
Confirmed. W.
The bug ist still present in gcc 4.3.0: bug.cpp:16: internal compiler error: in create_tmp_var, at gimplify.c:497
This appears to work for me now with gcc version 4.4.0 20080527 (experimental) [trunk revision 136055] (GCC) Can you check whether it also works for you? W.
I tried gcc 4.4.0 20080613 (experimental): indeed, it works now!
gcc release 4.3.1 already works!