Bug 26456 - OpenMP program deadlocks when executed
Summary: OpenMP program deadlocks when executed
Status: RESOLVED DUPLICATE of bug 25978
Alias: None
Product: gcc
Classification: Unclassified
Component: libgomp (show other bugs)
Version: 4.2.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-02-24 14:22 UTC by Jussi Eloranta
Modified: 2006-02-24 15:09 UTC (History)
3 users (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 Jussi Eloranta 2006-02-24 14:22:05 UTC
OpenMP C programs deadlock immediately after starting when OMP_NUM_THREADS is > 1.
For example, the following simple code just hangs:

#include <stdio.h>

main() {

  int i;

#pragma omp parallel for private(i)
  for (i = 0; i < 100; i++)
    printf("Thread = %d.\n", omp_get_thread_num());
}

This occurs on MacOS X 10.4.5 with gcc version:

Using built-in specs.
Target: powerpc-apple-darwin8.4.0
Configured with: /opt/local/var/db/dports/build/_opt_local_var_db_dports_sources_rsync.rsync.darwinports.org_dpupdate_dports_lang_gcc42/work/gcc-4.2-20060204/configure --prefix=/opt/local --enable-languages=c,c++,java,objc,fortran --libdir=/opt/local/lib/gcc42 --includedir=/opt/local/include/gcc42 --infodir=/opt/local/share/info --mandir=/opt/local/share/man --with-local-prefix=/opt/local --with-system-zlib --disable-nls --program-suffix=-dp-4.2 --with-gxx-include-dir=/opt/local/include/gcc42/c++/ --with-gmp=/opt/local --with-mpfr=/opt/local --disable-multilib
Thread model: posix
gcc version 4.2.0 20060204 (experimental)

Also it appears that when -fopenmp switch is used, gcc does not automatically include -lgomp but
this has to be done by hand.
Comment 1 Jussi Eloranta 2006-02-24 14:23:37 UTC
Most likely this is just OS X specific bug.
Comment 2 Andrew Pinski 2006-02-24 15:09:08 UTC
This is Darwin specific.

This is a dup of bug 25978.

*** This bug has been marked as a duplicate of 25978 ***