template<uint32_t otherCOLS>
Matrix<ROWS, otherCOLS, T> operator* (const Matrix<COLS, otherCOLS, T>& o)
const throw()
{
    Matrix<ROWS, otherCOLS, T> res;

    float sum;
    uint32_t i, j, k;

116:    #pragma omp parallel for private(i,j,k, sum)
117:    for (i = 0; i < ROWS; ++i)
118:    {
        for (j = 0; j < otherCOLS; ++j)
        {
            sum = 0;
            for (k = 0; k < COLS; ++k)
            {
                sum += (*this)(i,k) * o(k,j);
            }
            res(i,j) = sum;
        }
    }

    return res;
}

Trying to compile above function results in: 

In file included from FWLSEPred.h:6,
                 from main.cpp:11:
Matrix.h: In member function ‘Matrix<ROWS, otherCOLS, T> Matrix<ROWS, COLS,
T>::operator*(const Matrix<COLS, otherCOLS, T>&) const [with unsigned int
otherCOLS = 1u, unsigned int ROWS = 1u, unsigned int COLS = 100u, T = float]’:
FWLSEPred.h:57:   instantiated from ‘void FWLSEPred<ORDER, T, C>::pushSample(T)
[with int ORDER = 100, T = short int, int C = 2]’
main.cpp:79:   instantiated from here
Matrix.h:117: error: invalid controlling predicate


Compiled with:
g++ -o predictor -std=gnu++0x -fopenmp <input cpp files...>

Works and compiles fine without -fopenmp.

A possible problem is that in this specific instantiation of the template, ROWS
equals one and the "parallel for" pragma fails as there is nothing to
parallelize. But this case should be recognized and the code should compile
without parallelization and without errors.


-- 
           Summary: Error: Invalid controlling predicate with -fopenmp
           Product: gcc
           Version: 4.4.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libgomp
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: e0600347 at student dot tuwien dot ac dot at


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43893

Reply via email to