public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug other/56240] New: -fopenmp and -pthread behave inconsistently with respect to -nostdlib
@ 2013-02-07 12:54 yury at shurup dot com
  0 siblings, 0 replies; only message in thread
From: yury at shurup dot com @ 2013-02-07 12:54 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56240

             Bug #: 56240
           Summary: -fopenmp and -pthread behave inconsistently with
                    respect to -nostdlib
    Classification: Unclassified
           Product: gcc
           Version: 4.4.5
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: other
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: yury@shurup.com


Hello,

As reported in #25460, if gcc is passed -nostdlib and -pthread options, the
libraries implied by -pthread are not added. It was decided that this is the
correct behavior and hence the bug was closed.

Now, if gcc is passed -nostdlib and -fopenmp, the libraries implied by -fopenmp
(and -pthread) are in fact added to the executable. The same test case as in
#25460 can be used to verify this (you have to use libtool 2.4.2+, however,
because earlier versions were filtering out OpenMP flags).

This behavior seems to be inconsistent to me.

In order to make it consistent, either the decision in #25460 can be
reconsidered and gcc can be made to adhere to -pthread even if -nostdlib is
specified, or the effect of -fopenmp can be changed in a way that gcc will not
add -lgomp and libraries implied by -pthread anymore.

I think that the first option is better, because the current behavior of
-fopenmp seems to make total sense to me, and, as a nice side effect, changing
the behavior of -pthread to match -fopenmp will "unbreak" libtool linking of
C++ programs that use threads.

The reasons why libtool uses -nostdlib / adds stubs directly and whether it
should do it or not can be debated, but they are outside the scope of this
report.

Thank you for your time,
--Yury.


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2013-02-07 12:54 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-02-07 12:54 [Bug other/56240] New: -fopenmp and -pthread behave inconsistently with respect to -nostdlib yury at shurup 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).