Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 455944 - gcc produced code that fails to link (openmp)
Summary: gcc produced code that fails to link (openmp)
Alias: None
Product: Fedora
Classification: Fedora
Component: gcc
Version: 9
Hardware: All
OS: Linux
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact: Fedora Extras Quality Assurance
Depends On:
TreeView+ depends on / blocked
Reported: 2008-07-19 00:06 UTC by Jussi Eloranta
Modified: 2008-07-19 19:40 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2008-07-19 19:40:50 UTC

Attachments (Terms of Use)

System ID Priority Status Summary Last Updated
GNU Compiler Collection 36877 None None None Never

Description Jussi Eloranta 2008-07-19 00:06:13 UTC
Description of problem:

On i386, if one compiles the following (not obviously a correct program; a
student of mine ran into this):


#include <stdio.h>
#include <math.h>

int main(int argc, char ** argv)

  int i;
  int lBound = 0.0;
  int hBound = 1.0;
  int delta = 0.00001;
  int sum = 0.0;

#pragma omp parallel for reduction(+:sum)
  for(i=lBound; i < hBound; i += delta) {
    sum += pow(i,2);

  printf("Integral of x^2 from [%d,%d] is: %d\n", lBound, hBound, sum);

  return 0;


and it is compiled with: gcc -fopenmp test.c -lm ; it produces the following

/tmp/ccQ7Hik5.o: In function `main.omp_fn.0':
test.c:(.text+0x1a4): undefined reference to `__sync_fetch_and_add_4'
collect2: ld returned 1 exit status

This is not what should happen... If one compiles it without -fopenmp, it
compiles just fine.

Comment 1 Jakub Jelinek 2008-07-19 19:40:50 UTC
Fixed upstream, will get into F9 and rawhides whenever gcc is updated there.
In the mean time, either compile with optimizations (-O -fopenmp or higher
should work), or compile for i486 or higher (-march=i486, -march=i586,
-march=i686 etc.).

Note You need to log in before you can comment on or make changes to this bug.