Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#1 G++ 4.3 and OpenMP bug

open
nobody
None
5
2008-03-04
2008-03-04
No

Hello there, consider this small OpenMP application:

int main(int argc, char** argv) {
double a[5] = { 1, 2, 3, 4, 5 };
double sum = 0.0;

#pragma omp parallel for reduction(+:sum)
for(int i = 0; i < N; i++)
sum = sum + a[i*i];
}

I compiled it with your compiler, version
g++ (GCC) 4.3.0 20080125 (experimental)

with the following command:

g++ benchmarks/omp_wikiexample.cpp -o omp_wikiexample -fopenmp

Now, for the same example, if you change the type of sum from double to int and compile again, you will get the following error:

/usr/bin/ld: Undefined symbols:
___sync_fetch_and_add_4
collect2: ld returned 1 exit status
make: *** [omp_wikiexample] Error 1

Discussion