public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug regression/52973] New: visibility attribute for class is not passed to its members
@ 2012-04-13 12:36 holger.hopp at sap dot com
  2012-04-13 12:47 ` [Bug c++/52973] [4.7/4.8 Regression] " rguenth at gcc dot gnu.org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: holger.hopp at sap dot com @ 2012-04-13 12:36 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 52973
           Summary: visibility attribute for class is not passed to its
                    members
    Classification: Unclassified
           Product: gcc
           Version: 4.7.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: regression
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: holger.hopp@sap.com


In following code, gcc-4.7 does not accept the visibility attribute
defined in the class declaration:

template <class T> class __attribute__((visibility("default"))) a
{
public:
  /* A */ static int c;
};

class __attribute__((visibility("default"))) b : a <b> {};

template<> /* B */ int a<b>::c = 0;


With g++-4.7, a<b>::c is hidden, with g++-4.6 (and before) it is not.

$ g++-4.7 -fvisibility=hidden -c def.cpp && objdump -Ct def.o | grep "a<b>"
0000000000000000 g     O .bss    0000000000000004 .hidden a<b>::c

$ g++-4.6 -fvisibility=hidden -c def.cpp && objdump -Ct def.o | grep "a<b>"
0000000000000000 g     O .bss    0000000000000004 a<b>::c

Setting the default visibility at /* A */ or /* B */ works with
g++-4.7, but I think that it still should work also with the code above.


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

* [Bug c++/52973] [4.7/4.8 Regression] visibility attribute for class is not passed to its members
  2012-04-13 12:36 [Bug regression/52973] New: visibility attribute for class is not passed to its members holger.hopp at sap dot com
@ 2012-04-13 12:47 ` rguenth at gcc dot gnu.org
  2012-04-13 13:19 ` rguenth at gcc dot gnu.org
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-04-13 12:47 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|regression                  |c++
      Known to work|                            |4.6.3
   Target Milestone|---                         |4.7.1
            Summary|visibility attribute for    |[4.7/4.8 Regression]
                   |class is not passed to its  |visibility attribute for
                   |members                     |class is not passed to its
                   |                            |members


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

* [Bug c++/52973] [4.7/4.8 Regression] visibility attribute for class is not passed to its members
  2012-04-13 12:36 [Bug regression/52973] New: visibility attribute for class is not passed to its members holger.hopp at sap dot com
  2012-04-13 12:47 ` [Bug c++/52973] [4.7/4.8 Regression] " rguenth at gcc dot gnu.org
@ 2012-04-13 13:19 ` rguenth at gcc dot gnu.org
  2012-04-15  9:11 ` paolo.carlini at oracle dot com
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-04-13 13:19 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P2


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

* [Bug c++/52973] [4.7/4.8 Regression] visibility attribute for class is not passed to its members
  2012-04-13 12:36 [Bug regression/52973] New: visibility attribute for class is not passed to its members holger.hopp at sap dot com
  2012-04-13 12:47 ` [Bug c++/52973] [4.7/4.8 Regression] " rguenth at gcc dot gnu.org
  2012-04-13 13:19 ` rguenth at gcc dot gnu.org
@ 2012-04-15  9:11 ` paolo.carlini at oracle dot com
  2012-06-01 21:22 ` jason at gcc dot gnu.org
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: paolo.carlini at oracle dot com @ 2012-04-15  9:11 UTC (permalink / raw)
  To: gcc-bugs

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

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jason at gcc dot gnu.org

--- Comment #1 from Paolo Carlini <paolo.carlini at oracle dot com> 2012-04-15 09:11:10 UTC ---
Jason, can you have a look?


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

* [Bug c++/52973] [4.7/4.8 Regression] visibility attribute for class is not passed to its members
  2012-04-13 12:36 [Bug regression/52973] New: visibility attribute for class is not passed to its members holger.hopp at sap dot com
                   ` (2 preceding siblings ...)
  2012-04-15  9:11 ` paolo.carlini at oracle dot com
@ 2012-06-01 21:22 ` jason at gcc dot gnu.org
  2012-06-01 21:36 ` jason at gcc dot gnu.org
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: jason at gcc dot gnu.org @ 2012-06-01 21:22 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2012-06-01
         AssignedTo|unassigned at gcc dot       |jason at gcc dot gnu.org
                   |gnu.org                     |
     Ever Confirmed|0                           |1


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

* [Bug c++/52973] [4.7/4.8 Regression] visibility attribute for class is not passed to its members
  2012-04-13 12:36 [Bug regression/52973] New: visibility attribute for class is not passed to its members holger.hopp at sap dot com
                   ` (3 preceding siblings ...)
  2012-06-01 21:22 ` jason at gcc dot gnu.org
@ 2012-06-01 21:36 ` jason at gcc dot gnu.org
  2012-06-02  4:04 ` jason at gcc dot gnu.org
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: jason at gcc dot gnu.org @ 2012-06-01 21:36 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Jason Merrill <jason at gcc dot gnu.org> 2012-06-01 21:36:35 UTC ---
The bug here is that we aren't applying the visibility attribute to b until
after we've decided that a<b> is hidden because b is hidden.  Changing the code
to

template <class T> class __attribute__((visibility("default"))) a
{
public:
  /* A */ static int c;
};

class __attribute__((visibility("default"))) b;
class b: a <b> {};

template<> /* B */ int a<b>::c = 0;

works around the issue.


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

* [Bug c++/52973] [4.7/4.8 Regression] visibility attribute for class is not passed to its members
  2012-04-13 12:36 [Bug regression/52973] New: visibility attribute for class is not passed to its members holger.hopp at sap dot com
                   ` (4 preceding siblings ...)
  2012-06-01 21:36 ` jason at gcc dot gnu.org
@ 2012-06-02  4:04 ` jason at gcc dot gnu.org
  2012-06-02  4:05 ` jason at gcc dot gnu.org
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: jason at gcc dot gnu.org @ 2012-06-02  4:04 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Jason Merrill <jason at gcc dot gnu.org> 2012-06-02 04:03:57 UTC ---
Author: jason
Date: Sat Jun  2 04:03:51 2012
New Revision: 188137

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=188137
Log:
    PR c++/52973
    * parser.c (cp_parser_class_head): Apply attributes here.
    * semantics.c (begin_class_definition): Not here.
    * cp-tree.h: Adjust.

Added:
    trunk/gcc/testsuite/g++.dg/ext/visibility/template12.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/cp-tree.h
    trunk/gcc/cp/parser.c
    trunk/gcc/cp/semantics.c
    trunk/gcc/objcp/ChangeLog
    trunk/gcc/objcp/objcp-decl.c
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/g++.dg/ext/attrib14.C


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

* [Bug c++/52973] [4.7/4.8 Regression] visibility attribute for class is not passed to its members
  2012-04-13 12:36 [Bug regression/52973] New: visibility attribute for class is not passed to its members holger.hopp at sap dot com
                   ` (5 preceding siblings ...)
  2012-06-02  4:04 ` jason at gcc dot gnu.org
@ 2012-06-02  4:05 ` jason at gcc dot gnu.org
  2012-06-02  4:06 ` jason at gcc dot gnu.org
  2012-06-02  4:06 ` jason at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: jason at gcc dot gnu.org @ 2012-06-02  4:05 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Jason Merrill <jason at gcc dot gnu.org> 2012-06-02 04:05:34 UTC ---
Author: jason
Date: Sat Jun  2 04:05:25 2012
New Revision: 188138

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=188138
Log:
    PR c++/52973
    * parser.c (cp_parser_class_head): Apply attributes here.
    * semantics.c (begin_class_definition): Not here.
    * cp-tree.h: Adjust.

Added:
    branches/gcc-4_7-branch/gcc/testsuite/g++.dg/ext/visibility/template12.C
Modified:
    branches/gcc-4_7-branch/gcc/cp/ChangeLog
    branches/gcc-4_7-branch/gcc/cp/cp-tree.h
    branches/gcc-4_7-branch/gcc/cp/parser.c
    branches/gcc-4_7-branch/gcc/cp/semantics.c
    branches/gcc-4_7-branch/gcc/objcp/objcp-decl.c
    branches/gcc-4_7-branch/gcc/testsuite/ChangeLog
    branches/gcc-4_7-branch/gcc/testsuite/g++.dg/ext/attrib14.C


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

* [Bug c++/52973] [4.7/4.8 Regression] visibility attribute for class is not passed to its members
  2012-04-13 12:36 [Bug regression/52973] New: visibility attribute for class is not passed to its members holger.hopp at sap dot com
                   ` (6 preceding siblings ...)
  2012-06-02  4:05 ` jason at gcc dot gnu.org
@ 2012-06-02  4:06 ` jason at gcc dot gnu.org
  2012-06-02  4:06 ` jason at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: jason at gcc dot gnu.org @ 2012-06-02  4:06 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED

--- Comment #4 from Jason Merrill <jason at gcc dot gnu.org> 2012-06-02 04:05:34 UTC ---
Author: jason
Date: Sat Jun  2 04:05:25 2012
New Revision: 188138

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=188138
Log:
    PR c++/52973
    * parser.c (cp_parser_class_head): Apply attributes here.
    * semantics.c (begin_class_definition): Not here.
    * cp-tree.h: Adjust.

Added:
    branches/gcc-4_7-branch/gcc/testsuite/g++.dg/ext/visibility/template12.C
Modified:
    branches/gcc-4_7-branch/gcc/cp/ChangeLog
    branches/gcc-4_7-branch/gcc/cp/cp-tree.h
    branches/gcc-4_7-branch/gcc/cp/parser.c
    branches/gcc-4_7-branch/gcc/cp/semantics.c
    branches/gcc-4_7-branch/gcc/objcp/objcp-decl.c
    branches/gcc-4_7-branch/gcc/testsuite/ChangeLog
    branches/gcc-4_7-branch/gcc/testsuite/g++.dg/ext/attrib14.C

--- Comment #5 from Jason Merrill <jason at gcc dot gnu.org> 2012-06-02 04:06:08 UTC ---
Fixed for 4.7.1.


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

* [Bug c++/52973] [4.7/4.8 Regression] visibility attribute for class is not passed to its members
  2012-04-13 12:36 [Bug regression/52973] New: visibility attribute for class is not passed to its members holger.hopp at sap dot com
                   ` (7 preceding siblings ...)
  2012-06-02  4:06 ` jason at gcc dot gnu.org
@ 2012-06-02  4:06 ` jason at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: jason at gcc dot gnu.org @ 2012-06-02  4:06 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED

--- Comment #5 from Jason Merrill <jason at gcc dot gnu.org> 2012-06-02 04:06:08 UTC ---
Fixed for 4.7.1.


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

end of thread, other threads:[~2012-06-02  4:06 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-13 12:36 [Bug regression/52973] New: visibility attribute for class is not passed to its members holger.hopp at sap dot com
2012-04-13 12:47 ` [Bug c++/52973] [4.7/4.8 Regression] " rguenth at gcc dot gnu.org
2012-04-13 13:19 ` rguenth at gcc dot gnu.org
2012-04-15  9:11 ` paolo.carlini at oracle dot com
2012-06-01 21:22 ` jason at gcc dot gnu.org
2012-06-01 21:36 ` jason at gcc dot gnu.org
2012-06-02  4:04 ` jason at gcc dot gnu.org
2012-06-02  4:05 ` jason at gcc dot gnu.org
2012-06-02  4:06 ` jason at gcc dot gnu.org
2012-06-02  4:06 ` 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).