Bug 833440 - gcc 4.7/4.8 Regression: visibility attribute for class is not passed to its members
gcc 4.7/4.8 Regression: visibility attribute for class is not passed to its m...
Status: CLOSED ERRATA
Product: Red Hat Developer Toolset
Classification: Red Hat
Component: gcc (Show other bugs)
unspecified
x86_64 Linux
high Severity high
: alpha
: 1.1
Assigned To: Jakub Jelinek
qe-baseos-tools
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2012-06-19 09:16 EDT by Frank Danapfel
Modified: 2013-01-22 09:35 EST (History)
5 users (show)

See Also:
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.
Story Points: ---
Clone Of:
Environment:
Last Closed: 2013-01-22 09:35:38 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)


External Trackers
Tracker ID Priority Status Summary Last Updated
GNU Compiler Collection 52973 None None None Never

  None (edit)
Description Frank Danapfel 2012-06-19 09:16:11 EDT
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 08:09:33 EDT
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 09:35:38 EST
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.