Bug 617719

Summary: [RHEL6] info page for gcc needs update re: -pthread
Product: Red Hat Enterprise Linux 6 Reporter: Issue Tracker <tao>
Component: gccAssignee: Jakub Jelinek <jakub>
Status: CLOSED WONTFIX QA Contact: qe-baseos-tools-bugs
Severity: medium Docs Contact:
Priority: medium    
Version: 6.0CC: tao, tgummels
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2010-11-30 14:05:20 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Issue Tracker 2010-07-23 19:40:06 UTC
Escalated to Bugzilla from IssueTracker

Comment 1 Issue Tracker 2010-07-23 19:40:08 UTC
Event posted on 07-21-2010 12:46pm EDT by woodard

Description of problem:
The info page says one thing:

`-mt'
`-pthread'
     Add support for multithreading using the POSIX threads library.
     This option sets flags for both the preprocessor and linker.  It
     does not affect the thread safety of object code produced by the
     compiler or that of libraries supplied with it.  These are HP-UX
     specific flags.

This email says something else:
http://gcc.gnu.org/ml/gcc/2010-05/msg00059.html

It looks like the docs need to be updated a bit.

This issue needs to be cloned for RHEL5 as well. Same problem.
This event sent from IssueTracker by tgummels  [LLNL (HPC)]
 issue 1168973

Comment 3 Travis Gummels 2010-07-23 19:45:37 UTC
Email referenced in Comment 1

Magnus Fromreide <magfr.se> writes:

> I recently ended up in a discussion about the -pthread flag at work and
> when looking at the documentation I noticed that it is defined onlt for
> SPARC and RS/6000/PowerPC.
>
> Additionally -fopenmp and -ftree-parallelize-loops say they are only
> supported on targets where -pthread are available.
>
> Now, on x86-linux it seems as if -pthread does something but there is no
> documentation of it so I'd like to know
>
>       * What does -pthread do on x86?

On x86 GNU/Linux -pthread defines _REENTRANT for the preprocessor and
links against -lpthread.

>       * If I am to compile a threaded program am I then requiered to use
>         -pthread?

On GNU/Linux, you need to use -pthread or -D_REENTRANT at compilation
time, and you need to use -pthread or -lpthread at link time.

I agree that this really ought to be documented.

Ian

Comment 4 Jakub Jelinek 2010-11-22 08:48:52 UTC
-D_REENTRANT has so little effect on Linux that it is IMNSHO not worth mentioning.
It affects only presence of getlogin_r prototype in unistd.h, but that prototype is defined either if _REENTRANT is defined, or if POSIX >= 199506 is requested (the latter is by default, unless you request strict compliance with something older).  So, in reality, -pthread is basically ignored during compilation, and during linking it is just equivalent of -lpthread.

Comment 5 RHEL Program Management 2010-11-30 14:05:20 UTC
Development Management has reviewed and declined this request.  You may appeal
this decision by reopening this request.