public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/55800] New: Link failure with thread_local in unnamed namespace
@ 2012-12-23 20:28 vlukas at gmx dot de
  2013-06-14 22:43 ` [Bug c++/55800] " meyerm at fs dot tum.de
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: vlukas at gmx dot de @ 2012-12-23 20:28 UTC (permalink / raw)
  To: gcc-bugs


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

             Bug #: 55800
           Summary: Link failure with thread_local in unnamed namespace
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: vlukas@gmx.de


Considering this snippet:
-------------------------------------------------------

namespace {
  struct X { X() { } };
  thread_local X x;  
}

int main() { x; }
-----------------------------------------------------

Compiling with "c++ -std=c++0x" results in:
----------------------------------------------------
/tmp/cceAUNGB.o: In function `_ZTWN12_GLOBAL__N_11xE':
thread_local.link_failure.with_main.cc:(.text+0x55): undefined reference to
`_ZTHN12_GLOBAL__N_11xE'
collect2: error: ld returned 1 exit status
------------------------------------------------------

Output of c++ -v is:
-----------------------------------------------------------
Using built-in specs.
COLLECT_GCC=/home/lima/vanilla_installs/gcc_and_tools/bin/c++
COLLECT_LTO_WRAPPER=/home/lima/vanilla_installs/gcc_and_tools/lib/gcc/x86_64-unknown-linux-gnu/4.8.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../gcc_svn/configure
--prefix=/home/lima/vanilla_installs/gcc_and_tools --enable-__cxa_atexit
--enable-languages=c,c++ --disable-nls --disable-multilib
Thread model: posix
gcc version 4.8.0 20121223 (experimental) (GCC)
-----------------------------------------------------------


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

* [Bug c++/55800] Link failure with thread_local in unnamed namespace
  2012-12-23 20:28 [Bug c++/55800] New: Link failure with thread_local in unnamed namespace vlukas at gmx dot de
@ 2013-06-14 22:43 ` meyerm at fs dot tum.de
  2014-01-30 15:24 ` rguenth at gcc dot gnu.org
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: meyerm at fs dot tum.de @ 2013-06-14 22:43 UTC (permalink / raw)
  To: gcc-bugs

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

Marcel Meyer <meyerm at fs dot tum.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |meyerm at fs dot tum.de

--- Comment #1 from Marcel Meyer <meyerm at fs dot tum.de> ---
Confirmed for 4.8.1 (using -std=c++11). Seems to be the same as bug #57163.


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

* [Bug c++/55800] Link failure with thread_local in unnamed namespace
  2012-12-23 20:28 [Bug c++/55800] New: Link failure with thread_local in unnamed namespace vlukas at gmx dot de
  2013-06-14 22:43 ` [Bug c++/55800] " meyerm at fs dot tum.de
@ 2014-01-30 15:24 ` rguenth at gcc dot gnu.org
  2014-01-30 15:42 ` linedot at xcpp dot org
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-01-30 15:24 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
      Known to work|                            |4.8.0
         Resolution|---                         |FIXED

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
Works for me with 4.8.0 and later.


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

* [Bug c++/55800] Link failure with thread_local in unnamed namespace
  2012-12-23 20:28 [Bug c++/55800] New: Link failure with thread_local in unnamed namespace vlukas at gmx dot de
  2013-06-14 22:43 ` [Bug c++/55800] " meyerm at fs dot tum.de
  2014-01-30 15:24 ` rguenth at gcc dot gnu.org
@ 2014-01-30 15:42 ` linedot at xcpp dot org
  2014-01-30 15:49 ` rguenth at gcc dot gnu.org
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: linedot at xcpp dot org @ 2014-01-30 15:42 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from linedot at xcpp dot org ---
The code from comment 2 still doesn't work with GCC 4.8.2
=========================================================================
gcc -v:
Using built-in specs.
COLLECT_GCC=/usr/x86_64-pc-linux-gnu/gcc-bin/4.8.2/gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-pc-linux-gnu/4.8.2/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /var/tmp/portage/sys-devel/gcc-4.8.2/work/gcc-4.8.2/configure
--host=x86_64-pc-linux-gnu --build=x86_64-pc-linux-gnu --prefix=/usr
--bindir=/usr/x86_64-pc-linux-gnu/gcc-bin/4.8.2
--includedir=/usr/lib/gcc/x86_64-pc-linux-gnu/4.8.2/include
--datadir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.8.2
--mandir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.8.2/man
--infodir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.8.2/info
--with-gxx-include-dir=/usr/lib/gcc/x86_64-pc-linux-gnu/4.8.2/include/g++-v4
--with-python-dir=/share/gcc-data/x86_64-pc-linux-gnu/4.8.2/python
--enable-languages=c,c++,fortran --enable-obsolete --enable-secureplt
--disable-werror --with-system-zlib --enable-nls --without-included-gettext
--enable-checking=release --with-bugurl=https://bugs.gentoo.org/
--with-pkgversion='Gentoo 4.8.2 p1.3, pie-0.5.8' --enable-libstdcxx-time
--enable-shared --enable-threads=posix --enable-__cxa_atexit
--enable-clocale=gnu --enable-multilib --with-multilib-list=m32,m64
--disable-altivec --disable-fixed-point --enable-targets=all --disable-libgcj
--enable-libgomp --enable-libmudflap --disable-libssp --enable-lto --with-cloog
--disable-isl-version-check
Thread model: posix
gcc version 4.8.2 (Gentoo 4.8.2 p1.3, pie-0.5.8) 
=========================================================================

output of compiling code from Comment 2:
g++ -std=c++11 main.cpp xyz.cpp

/tmp/cccXvzux.o: In function `TLS wrapper function for xyz::bla':
main.cpp:(.text._ZTWN3xyz3blaE[_ZTWN3xyz3blaE]+0x5): undefined reference to
`TLS init function for xyz::bla'
collect2: error: ld returned 1 exit status
=========================================================================


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

* [Bug c++/55800] Link failure with thread_local in unnamed namespace
  2012-12-23 20:28 [Bug c++/55800] New: Link failure with thread_local in unnamed namespace vlukas at gmx dot de
                   ` (2 preceding siblings ...)
  2014-01-30 15:42 ` linedot at xcpp dot org
@ 2014-01-30 15:49 ` rguenth at gcc dot gnu.org
  2014-01-31 15:48 ` jason at gcc dot gnu.org
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-01-30 15:49 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to work|4.8.0                       |4.9.0

--- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> ---
Works with 4.9 though.


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

* [Bug c++/55800] Link failure with thread_local in unnamed namespace
  2012-12-23 20:28 [Bug c++/55800] New: Link failure with thread_local in unnamed namespace vlukas at gmx dot de
                   ` (4 preceding siblings ...)
  2014-01-31 15:48 ` jason at gcc dot gnu.org
@ 2014-01-31 15:48 ` jason at gcc dot gnu.org
  2014-01-31 16:26 ` jason at gcc dot gnu.org
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: jason at gcc dot gnu.org @ 2014-01-31 15:48 UTC (permalink / raw)
  To: gcc-bugs

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

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |ASSIGNED
   Last reconfirmed|                            |2014-01-31
                 CC|                            |jason at gcc dot gnu.org
         Resolution|FIXED                       |---
           Assignee|unassigned at gcc dot gnu.org      |jason at gcc dot gnu.org
     Ever confirmed|0                           |1


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

* [Bug c++/55800] Link failure with thread_local in unnamed namespace
  2012-12-23 20:28 [Bug c++/55800] New: Link failure with thread_local in unnamed namespace vlukas at gmx dot de
                   ` (3 preceding siblings ...)
  2014-01-30 15:49 ` rguenth at gcc dot gnu.org
@ 2014-01-31 15:48 ` jason at gcc dot gnu.org
  2014-01-31 15:48 ` jason at gcc dot gnu.org
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: jason at gcc dot gnu.org @ 2014-01-31 15:48 UTC (permalink / raw)
  To: gcc-bugs

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

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |conradsand.arma at gmail dot com

--- Comment #6 from Jason Merrill <jason at gcc dot gnu.org> ---
*** Bug 59364 has been marked as a duplicate of this bug. ***


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

* [Bug c++/55800] Link failure with thread_local in unnamed namespace
  2012-12-23 20:28 [Bug c++/55800] New: Link failure with thread_local in unnamed namespace vlukas at gmx dot de
                   ` (5 preceding siblings ...)
  2014-01-31 15:48 ` jason at gcc dot gnu.org
@ 2014-01-31 16:26 ` jason at gcc dot gnu.org
  2014-01-31 16:26 ` jason at gcc dot gnu.org
  2014-01-31 16:26 ` jason at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: jason at gcc dot gnu.org @ 2014-01-31 16:26 UTC (permalink / raw)
  To: gcc-bugs

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

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED
   Target Milestone|---                         |4.8.3

--- Comment #7 from Jason Merrill <jason at gcc dot gnu.org> ---
Fixed for 4.8.3.

--- Comment #8 from Jason Merrill <jason at gcc dot gnu.org> ---
Author: jason
Date: Fri Jan 31 16:25:55 2014
New Revision: 207360

URL: http://gcc.gnu.org/viewcvs?rev=207360&root=gcc&view=rev
Log:
    PR c++/55800
    * decl2.c (get_tls_init_fn): Copy DECL_EXTERNAL from the variable.

Added:
    trunk/gcc/testsuite/g++.dg/tls/thread_local8.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/decl2.c


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

* [Bug c++/55800] Link failure with thread_local in unnamed namespace
  2012-12-23 20:28 [Bug c++/55800] New: Link failure with thread_local in unnamed namespace vlukas at gmx dot de
                   ` (6 preceding siblings ...)
  2014-01-31 16:26 ` jason at gcc dot gnu.org
@ 2014-01-31 16:26 ` jason at gcc dot gnu.org
  2014-01-31 16:26 ` jason at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: jason at gcc dot gnu.org @ 2014-01-31 16:26 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #9 from Jason Merrill <jason at gcc dot gnu.org> ---
Author: jason
Date: Fri Jan 31 16:26:02 2014
New Revision: 207361

URL: http://gcc.gnu.org/viewcvs?rev=207361&root=gcc&view=rev
Log:
    PR c++/55800
    * decl2.c (get_tls_init_fn): Copy DECL_EXTERNAL from the variable.

Added:
    branches/gcc-4_8-branch/gcc/testsuite/g++.dg/tls/thread_local8.C
Modified:
    branches/gcc-4_8-branch/gcc/cp/ChangeLog
    branches/gcc-4_8-branch/gcc/cp/decl2.c


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

* [Bug c++/55800] Link failure with thread_local in unnamed namespace
  2012-12-23 20:28 [Bug c++/55800] New: Link failure with thread_local in unnamed namespace vlukas at gmx dot de
                   ` (7 preceding siblings ...)
  2014-01-31 16:26 ` jason at gcc dot gnu.org
@ 2014-01-31 16:26 ` jason at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: jason at gcc dot gnu.org @ 2014-01-31 16:26 UTC (permalink / raw)
  To: gcc-bugs

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

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED
   Target Milestone|---                         |4.8.3

--- Comment #7 from Jason Merrill <jason at gcc dot gnu.org> ---
Fixed for 4.8.3.


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

end of thread, other threads:[~2014-01-31 16:26 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-12-23 20:28 [Bug c++/55800] New: Link failure with thread_local in unnamed namespace vlukas at gmx dot de
2013-06-14 22:43 ` [Bug c++/55800] " meyerm at fs dot tum.de
2014-01-30 15:24 ` rguenth at gcc dot gnu.org
2014-01-30 15:42 ` linedot at xcpp dot org
2014-01-30 15:49 ` rguenth at gcc dot gnu.org
2014-01-31 15:48 ` jason at gcc dot gnu.org
2014-01-31 15:48 ` jason at gcc dot gnu.org
2014-01-31 16:26 ` jason at gcc dot gnu.org
2014-01-31 16:26 ` jason at gcc dot gnu.org
2014-01-31 16:26 ` jason 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).