public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "yury at shurup dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug other/56240] New: -fopenmp and -pthread behave inconsistently with respect to -nostdlib
Date: Thu, 07 Feb 2013 12:54:00 -0000	[thread overview]
Message-ID: <bug-56240-4@http.gcc.gnu.org/bugzilla/> (raw)


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.


                 reply	other threads:[~2013-02-07 12:54 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-56240-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).