Bug 42853 - omp private vector
Summary: omp private vector
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.2.4
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-01-24 04:01 UTC by Anna C
Modified: 2010-01-24 13:16 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Anna C 2010-01-24 04:01:12 UTC
I try to compile the following code:
#include <omp.h>
#include <vector>

using std::vector;

int main()
{
        vector<int> kdPoints;
        vector<int> results;
        vector<int>::iterator iter;
        vector<int> histogram;

        for (long long i = 0; i < 1000000; i++) kdPoints.push_back(i);

        histogram.push_back(0);
        #pragma omp parallel for private(results)
        for (long long i = 0; i < kdPoints.size(); i++) {
                #pragma omp critical
                {histogram[results.size()]++;}
                results.clear();
        }

}

using g++-4.2 *.cpp -fopenmp

I get the following message:
bug_omp.cpp: In function ‘int main()’:
bug_omp.cpp:0: internal compiler error: in lower_stmt, at gimple-low.c:282
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.
Comment 1 Richard Biener 2010-01-24 13:16:10 UTC
Works for me with GCC 4.3.4 and 4.4.2.  GCC 4.2 is no longer maintained.