public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/19450] New: __thread static class members
@ 2005-01-14 19:14 gcc-bugzilla at gcc dot gnu dot org
  2005-01-14 19:31 ` [Bug c++/19450] " pinskia at gcc dot gnu dot org
  2005-02-13 14:25 ` pinskia at gcc dot gnu dot org
  0 siblings, 2 replies; 10+ messages in thread
From: gcc-bugzilla at gcc dot gnu dot org @ 2005-01-14 19:14 UTC (permalink / raw)
  To: gcc-bugs


gcc generates incorrect code for static members in some cases.  Consider the
following code:

struct C {
        static __thread int x;
        static __thread int y;
};

__thread int C::x;

void g() {
        int z = C::x;
        z = C::y;
}

When this is compiled on an x86 machine with gcc -S, the body of g() is
translated as:

        movl    %gs:_ZN1C1xE@NTPOFF, %eax
        movl    %eax, -4(%ebp)
        movl    _ZN1C1yE, %eax
        movl    %eax, -4(%ebp)

note that C::x is accessed using an offset from the thread pointer, which
is correct.  C::y, however, is accessed as if it were an ordinary (not
thread-local) static member, which is incorrect.  I have also observed
this problem on ia64 machines, so it seems to be a general issue.

These are similar to the symptoms described in bug 13668, although that was
determined to be a glibc issue.  I see no way in which glibc could be
involved here.

Environment:
System: Linux algol.uwaterloo.ca 2.6.8-1-k7 #1 Thu Nov 25 04:13:37 UTC 2004 i686 GNU/Linux
Architecture: i686

	
host: i486-pc-linux-gnu
build: i486-pc-linux-gnu
target: i486-pc-linux-gnu
configured with: ../gcc/configure -v --enable-languages=c,c++ --prefix=/u/rcbilson/software/gcc --enable-shared --with-system-zlib --enable-nls --without-included-gettext --enable-__cxa_atexit --enable-clocale=gnu --enable-debug i486-linux

How-To-Repeat:
        Compile the above code fragment using gcc -S.

-- 
           Summary: __thread static class members
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: rcbilson at plg dot uwaterloo dot ca
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i486-pc-linux-gnu
  GCC host triplet: i486-pc-linux-gnu
GCC target triplet: i486-pc-linux-gnu


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


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

* [Bug c++/19450] __thread static class members
  2005-01-14 19:14 [Bug c++/19450] New: __thread static class members gcc-bugzilla at gcc dot gnu dot org
@ 2005-01-14 19:31 ` pinskia at gcc dot gnu dot org
  2005-02-13 14:25 ` pinskia at gcc dot gnu dot org
  1 sibling, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-01-14 19:31 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-01-14 19:31 -------
It does not work with 20041211 but that is the last gcc which I have access to which has __thread 
support.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |wrong-code


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


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

* [Bug c++/19450] __thread static class members
  2005-01-14 19:14 [Bug c++/19450] New: __thread static class members gcc-bugzilla at gcc dot gnu dot org
  2005-01-14 19:31 ` [Bug c++/19450] " pinskia at gcc dot gnu dot org
@ 2005-02-13 14:25 ` pinskia at gcc dot gnu dot org
  1 sibling, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-02-13 14:25 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-02-12 23:18 -------
Confirmed.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pinskia at gcc dot gnu dot
                   |                            |org
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
   Last reconfirmed|0000-00-00 00:00:00         |2005-02-12 23:18:56
               date|                            |


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


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

* [Bug c++/19450] __thread static class members
       [not found] <bug-19450-6420@http.gcc.gnu.org/bugzilla/>
                   ` (5 preceding siblings ...)
  2005-11-09 21:44 ` jakub at gcc dot gnu dot org
@ 2005-11-09 23:42 ` pinskia at gcc dot gnu dot org
  6 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-11-09 23:42 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from pinskia at gcc dot gnu dot org  2005-11-09 23:42 -------
Fixed for 4.0.3 also.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|4.1.0                       |4.0.3


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


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

* [Bug c++/19450] __thread static class members
       [not found] <bug-19450-6420@http.gcc.gnu.org/bugzilla/>
                   ` (4 preceding siblings ...)
  2005-11-08 22:13 ` pinskia at gcc dot gnu dot org
@ 2005-11-09 21:44 ` jakub at gcc dot gnu dot org
  2005-11-09 23:42 ` pinskia at gcc dot gnu dot org
  6 siblings, 0 replies; 10+ messages in thread
From: jakub at gcc dot gnu dot org @ 2005-11-09 21:44 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from jakub at gcc dot gnu dot org  2005-11-09 21:44 -------
Subject: Bug 19450

Author: jakub
Date: Wed Nov  9 21:44:36 2005
New Revision: 106710

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=106710
Log:
        PR c++/19450
        * decl.c (redeclaration_error_message): Issue diagnostics about
        olddecl and newdecl disagreement on __thread property.
        (grokdeclarator): Set DECL_THREAD_LOCAL on class static variables.

        * g++.dg/tls/diag-3.C: New test.
        * g++.dg/tls/diag-4.C: New test.
        * g++.dg/tls/static-1.C: New test.
        * g++.dg/tls/static-1a.cc: New file.

Added:
    branches/gcc-4_0-branch/gcc/testsuite/g++.dg/tls/diag-3.C
    branches/gcc-4_0-branch/gcc/testsuite/g++.dg/tls/diag-4.C
    branches/gcc-4_0-branch/gcc/testsuite/g++.dg/tls/static-1.C
    branches/gcc-4_0-branch/gcc/testsuite/g++.dg/tls/static-1a.cc
Modified:
    branches/gcc-4_0-branch/gcc/cp/ChangeLog
    branches/gcc-4_0-branch/gcc/cp/decl.c
    branches/gcc-4_0-branch/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug c++/19450] __thread static class members
       [not found] <bug-19450-6420@http.gcc.gnu.org/bugzilla/>
                   ` (3 preceding siblings ...)
  2005-11-08 21:45 ` jakub at gcc dot gnu dot org
@ 2005-11-08 22:13 ` pinskia at gcc dot gnu dot org
  2005-11-09 21:44 ` jakub at gcc dot gnu dot org
  2005-11-09 23:42 ` pinskia at gcc dot gnu dot org
  6 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-11-08 22:13 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from pinskia at gcc dot gnu dot org  2005-11-08 22:13 -------
Fixed.


-- 

pinskia at gcc dot gnu dot org changed:

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


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


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

* [Bug c++/19450] __thread static class members
       [not found] <bug-19450-6420@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2005-11-08 17:41 ` simon dot marshall at misys dot com
@ 2005-11-08 21:45 ` jakub at gcc dot gnu dot org
  2005-11-08 22:13 ` pinskia at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 10+ messages in thread
From: jakub at gcc dot gnu dot org @ 2005-11-08 21:45 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from jakub at gcc dot gnu dot org  2005-11-08 21:45 -------
Subject: Bug 19450

Author: jakub
Date: Tue Nov  8 21:44:58 2005
New Revision: 106657

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=106657
Log:
        PR c++/19450
        * decl.c (redeclaration_error_message): Issue diagnostics about
        olddecl and newdecl disagreement on __thread property.
        (grokdeclarator): Set DECL_TLS_MODEL on class static variables.

        * g++.dg/tls/diag-3.C: New test.
        * g++.dg/tls/diag-4.C: New test.
        * g++.dg/tls/static-1.C: New test.
        * g++.dg/tls/static-1a.cc: New file.

Added:
    trunk/gcc/testsuite/g++.dg/tls/diag-3.C
    trunk/gcc/testsuite/g++.dg/tls/diag-4.C
    trunk/gcc/testsuite/g++.dg/tls/static-1.C
    trunk/gcc/testsuite/g++.dg/tls/static-1a.cc
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/decl.c
    trunk/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug c++/19450] __thread static class members
       [not found] <bug-19450-6420@http.gcc.gnu.org/bugzilla/>
  2005-11-08 13:02 ` pinskia at gcc dot gnu dot org
  2005-11-08 13:08 ` jakub at gcc dot gnu dot org
@ 2005-11-08 17:41 ` simon dot marshall at misys dot com
  2005-11-08 21:45 ` jakub at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 10+ messages in thread
From: simon dot marshall at misys dot com @ 2005-11-08 17:41 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from simon dot marshall at misys dot com  2005-11-08 17:41 -------
Is there a target milestone for this?  IWBI it were fixed on 3.4 as well as
4.0.
(Appologies if I seem impertinent, I'm not too familiar with the way things
work.)


-- 


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


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

* [Bug c++/19450] __thread static class members
       [not found] <bug-19450-6420@http.gcc.gnu.org/bugzilla/>
  2005-11-08 13:02 ` pinskia at gcc dot gnu dot org
@ 2005-11-08 13:08 ` jakub at gcc dot gnu dot org
  2005-11-08 17:41 ` simon dot marshall at misys dot com
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 10+ messages in thread
From: jakub at gcc dot gnu dot org @ 2005-11-08 13:08 UTC (permalink / raw)
  To: gcc-bugs



-- 

jakub at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |jakub at gcc dot gnu dot org
                   |dot org                     |
             Status|NEW                         |ASSIGNED
   Last reconfirmed|2005-10-27 16:32:35         |2005-11-08 13:07:56
               date|                            |


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


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

* [Bug c++/19450] __thread static class members
       [not found] <bug-19450-6420@http.gcc.gnu.org/bugzilla/>
@ 2005-11-08 13:02 ` pinskia at gcc dot gnu dot org
  2005-11-08 13:08 ` jakub at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-11-08 13:02 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from pinskia at gcc dot gnu dot org  2005-11-08 13:02 -------
*** Bug 13668 has been marked as a duplicate of this bug. ***


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |simon dot marshall at misys
                   |                            |dot com


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


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

end of thread, other threads:[~2005-11-09 23:42 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-01-14 19:14 [Bug c++/19450] New: __thread static class members gcc-bugzilla at gcc dot gnu dot org
2005-01-14 19:31 ` [Bug c++/19450] " pinskia at gcc dot gnu dot org
2005-02-13 14:25 ` pinskia at gcc dot gnu dot org
     [not found] <bug-19450-6420@http.gcc.gnu.org/bugzilla/>
2005-11-08 13:02 ` pinskia at gcc dot gnu dot org
2005-11-08 13:08 ` jakub at gcc dot gnu dot org
2005-11-08 17:41 ` simon dot marshall at misys dot com
2005-11-08 21:45 ` jakub at gcc dot gnu dot org
2005-11-08 22:13 ` pinskia at gcc dot gnu dot org
2005-11-09 21:44 ` jakub at gcc dot gnu dot org
2005-11-09 23:42 ` pinskia at gcc dot gnu dot 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).