public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug nptl/5780] New: OpenMP program linked with static libraries gets a runtime memory fault
@ 2008-02-21  0:04 geir at cray dot com
  2008-02-21 14:12 ` [Bug nptl/5780] " carlos at codesourcery dot com
  0 siblings, 1 reply; 7+ messages in thread
From: geir at cray dot com @ 2008-02-21  0:04 UTC (permalink / raw)
  To: glibc-bugs

Simple OpenMP program will not work when compiled with '-static' option

$ cat test.f90
      use omp_lib
      implicit none
      integer, parameter :: NT = 4
      integer :: nThreads(NT)

      print *, 'Call omp_set_dynamic'
!$    call omp_set_dynamic(.false.)
      print *, 'Call omp_set_num_threads'
!$    call omp_set_num_threads(NT)
      print *, 'Now enter the parallel region'

!$omp parallel default(none) shared(nThreads)
      nThreads(omp_get_thread_num()+1) = omp_get_num_threads()
!$omp end parallel

      print*, nThreads

      END
$ gfortran -fopenmp test.f90
$ ./a.out
 Call omp_set_dynamic
 Call omp_set_num_threads
 Now enter the parallel region
           4           4           4           4
$ gfortran -static -fopenmp test.f90
$ ./a.out
Memory fault
$

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30471 offers the following workaround:

$ gfortran -Wl,--whole-archive -lpthread -Wl,--no-whole-archive -fopenmp -static
test.f90
/usr/lib/../lib64/libpthread.a(sem_open.o): In function `sem_open':
(.text+0x46d): warning: the use of `mktemp' is dangerous, better use `mkstemp'
$ ./a.out
 Call omp_set_dynamic
 Call omp_set_num_threads
 Now enter the parallel region
           4           4           4           4
$

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31604#c5 provides analysis on where
the problem is occurring.

-- 
           Summary: OpenMP program linked with static libraries gets a
                    runtime memory fault
           Product: glibc
           Version: 2.4
            Status: NEW
          Severity: normal
          Priority: P2
         Component: nptl
        AssignedTo: drepper at redhat dot com
        ReportedBy: geir at cray dot com
                CC: glibc-bugs at sources dot redhat dot com


http://sourceware.org/bugzilla/show_bug.cgi?id=5780

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


^ permalink raw reply	[flat|nested] 7+ messages in thread
[parent not found: <bug-5780-131@http.sourceware.org/bugzilla/>]

end of thread, other threads:[~2014-07-02  7:21 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-02-21  0:04 [Bug nptl/5780] New: OpenMP program linked with static libraries gets a runtime memory fault geir at cray dot com
2008-02-21 14:12 ` [Bug nptl/5780] " carlos at codesourcery dot com
     [not found] <bug-5780-131@http.sourceware.org/bugzilla/>
2012-09-06 23:26 ` hjl.tools at gmail dot com
2012-09-07  0:00 ` hjl.tools at gmail dot com
2014-02-16 18:29 ` jackie.rosen at hushmail dot com
2014-05-28 19:46 ` schwab at sourceware dot org
2014-07-02  7:21 ` fweimer at redhat dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).