Bug 26588 - gfortran -fopenmp passes unrecognised -pthread
Summary: gfortran -fopenmp passes unrecognised -pthread
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 4.2.0
: P3 normal
Target Milestone: 4.2.0
Assignee: David Billinghurst
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-03-07 02:04 UTC by David Billinghurst
Modified: 2006-03-14 01:25 UTC (History)
2 users (show)

See Also:
Host: i686-pc-cygwin
Target: i686-pc-cygwin
Build: i686-pc-cygwin
Known to work:
Known to fail:
Last reconfirmed: 2006-03-07 02:05:04


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description David Billinghurst 2006-03-07 02:04:31 UTC
On cygwin, gfortran -fopenmp gives the warning
  gfortran: unrecognized option '-pthread'
which gives a heap of failures in the testsuite.

This is set in gcc.c:
/* Adding -fopenmp should imply pthreads.  This is particularly important
   for targets that use different start files and suchlike.  */
#ifndef GOMP_SELF_SPECS
#define GOMP_SELF_SPECS "%{fopenmp: -pthread}"
#endif


I think the fix is to override it, as is done in gcc/config/darwin.h

/* Every program on darwin links against libSystem which contains the pthread
   routines, so there's no need to explicitly call out when doing threaded
   work.  */
#undef GOMP_SELF_SPECS
#define GOMP_SELF_SPECS ""

I'll prepare a patch at some stage.
Comment 1 David Billinghurst 2006-03-07 02:22:58 UTC
I am testing this.

2006-03-07  David Billinghurst (David.Billinghurst@riotinto.com)

        PR target/26588
        * config/i386/cygwin.h (GOMP_SELF_SPECS): Define.


--- cygwin.h~   2006-02-01 14:17:44.000000000 +1100
+++ cygwin.h    2006-03-07 13:08:52.420324700 +1100
@@ -232,3 +232,10 @@
 /* Binutils does not handle weak symbols from dlls correctly.  For now,
    do not use them unnecessarily in gthr-posix.h.  */
 #define GTHREAD_USE_WEAK 0
+
+/* Every program on cygwin links against cygwin.dll which contains 
+   the pthread routines.  There is no need to explicitly link them
+   and the -pthread flag is not recognised.  */
+#undef GOMP_SELF_SPECS
+#define GOMP_SELF_SPECS ""
Comment 2 David Billinghurst 2006-03-07 23:51:38 UTC
Subject: Bug 26588

Author: billingd
Date: Tue Mar  7 23:51:34 2006
New Revision: 111824

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=111824
Log:
2006-03-08  David Billinghurst <David.Billinghurst@riotinto.com>
 
	PR target/26588
	* config/i386/cygwin.h (GOMP_SELF_SPECS): Define.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/config/i386/cygwin.h

Comment 3 David Billinghurst 2006-03-07 23:55:30 UTC
Fixed by patch.