public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/53504] New: configure script of platform TLS support.
@ 2012-05-28  6:42 lyricconch at gmail dot com
  2021-08-31 16:11 ` [Bug bootstrap/53504] " redi at gcc dot gnu.org
  2021-08-31 16:23 ` redi at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: lyricconch at gmail dot com @ 2012-05-28  6:42 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 53504
           Summary: configure script of platform TLS support.
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: lyricconch@gmail.com


file: gcc-4.70/stdc++v3/configure
line: 51506

#include <pthread.h>
        __thread int a;
        static int *volatile a_in_other_thread;
        static void *
        thread_func (void *arg)
        {
          a_in_other_thread = &a;
          return (void *)0;
        }
int
main ()
{
pthread_t thread;
        void *thread_retval;
        int *volatile a_in_main_thread;
        a_in_main_thread = &a;
        if (pthread_create (&thread, (pthread_attr_t *)0,
                    thread_func, (void *)0))
          return 0;
        if (pthread_join (thread, &thread_retval))
          return 0;
        return (a_in_other_thread == a_in_main_thread);
  ;
  return 0;
}
_ACEOF
if ac_fn_c_try_run "$LINENO"; then :
  gcc_cv_have_tls=yes
else
  gcc_cv_have_tls=no
fi

1. if we have TLS support, &a will be difference value in main() and
hread_func(), which means (a_in_other_thread == a_in_main_thread) eval to
false.
so, with TLS support => program exit with 0.

2. if "pthread_create" or "pthread_join" fails, program also exit with 0. "no
threads, no TLS". 
so, without TLS support => program exit with 0.

whatever ac_fn_c_try_run get, this can not be right.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug bootstrap/53504] configure script of platform TLS support.
  2012-05-28  6:42 [Bug libstdc++/53504] New: configure script of platform TLS support lyricconch at gmail dot com
@ 2021-08-31 16:11 ` redi at gcc dot gnu.org
  2021-08-31 16:23 ` redi at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: redi at gcc dot gnu.org @ 2021-08-31 16:11 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53504

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2021-08-31
             Status|UNCONFIRMED                 |NEW
          Component|libstdc++                   |bootstrap
     Ever confirmed|0                           |1

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
That comes from config/tls.m4 which does not belong to libstdc++., so
component=bootstrap.

The test was added for PR 28468.

I agree the return values look wrong.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug bootstrap/53504] configure script of platform TLS support.
  2012-05-28  6:42 [Bug libstdc++/53504] New: configure script of platform TLS support lyricconch at gmail dot com
  2021-08-31 16:11 ` [Bug bootstrap/53504] " redi at gcc dot gnu.org
@ 2021-08-31 16:23 ` redi at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: redi at gcc dot gnu.org @ 2021-08-31 16:23 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53504

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Or maybe it's OK. The test is not trying to find out if threading works, only
whether TLS works. If creating or joining the thread fails, there is probably a
deeper issue. If creating and joining the thread works, then the important part
does the right thing. (a_in_other_thread == a_in_main_thread) being false makes
the program exit successfully, and we detect that TLS is supported.

The likelihood of linking with -pthread succeeding but pthread_create or
pthread_join failing is probably low, and so the check works in practice.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-08-31 16:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-05-28  6:42 [Bug libstdc++/53504] New: configure script of platform TLS support lyricconch at gmail dot com
2021-08-31 16:11 ` [Bug bootstrap/53504] " redi at gcc dot gnu.org
2021-08-31 16:23 ` redi at gcc dot gnu.org

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).