Bug 833440 - gcc 4.7/4.8 Regression: visibility attribute for class is not passed to its members
Summary: gcc 4.7/4.8 Regression: visibility attribute for class is not passed to its m...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Developer Toolset
Classification: Red Hat
Component: gcc
Version: unspecified
Hardware: x86_64
OS: Linux
high
high
Target Milestone: alpha
: 1.1
Assignee: Jakub Jelinek
QA Contact: qe-baseos-tools-bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-06-19 13:16 UTC by Frank Danapfel
Modified: 2013-01-22 14:35 UTC (History)
5 users (show)

Fixed In Version: devtoolset-1.1-gcc-4.7.1-7.el6
Doc Type: Release Note
Doc Text:
The GCC compiler now properly passes the visibility attribute from a class to its members.
Clone Of:
Environment:
Last Closed: 2013-01-22 14:35:38 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
GNU Compiler Collection 52973 0 None None None Never
Red Hat Product Errata RHEA-2013:0177 0 normal SHIPPED_LIVE new packages: devtoolset-1.1-gcc 2013-01-22 19:32:39 UTC

Description Frank Danapfel 2012-06-19 13:16:11 UTC
This was already reported upstream by SAP in GCC Bugzilla – Bug 52973:

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

According to the upstream bugzilla, this is fixed in gcc 4.7.1. It would be useful for SAP if the fix could also be integrated in the gcc shipped with the Developer Toolset.

Comment 5 Matt Newsome 2012-08-14 12:09:33 UTC
Jakub indicated fixed in devtoolset-1.1-gcc-4.7.1-7.el6 so attaching to erratum RHEA-2012:13624-01

Comment 9 errata-xmlrpc 2013-01-22 14:35:38 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHEA-2013-0177.html


Note You need to log in before you can comment on or make changes to this bug.