Bug 672157

Summary: debug info: Missing DW_AT_accessibility
Product: [Fedora] Fedora Reporter: Jan Kratochvil <jan.kratochvil>
Component: gccAssignee: Jakub Jelinek <jakub>
Status: CLOSED NOTABUG QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: low Docs Contact:
Priority: unspecified    
Version: rawhideCC: jakub
Target Milestone: ---Keywords: Regression
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-01-24 10:16:06 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Jan Kratochvil 2011-01-24 09:08:20 UTC
Description of problem:
By the upgrade some GDB testsuite cases fail.

Version-Release number of selected component (if applicable):
FAIL gcc-c++-4.6.0-0.3.fc15.x86_64
PASS gcc-c++-4.5.1-4.fc14.x86_64
PASS g++ (GCC) 4.6.0 20110124 (experimental)
PASS g++ (GCC) 4.5.3 20110124 (prerelease)
PASS g++ (GCC) 4.4.6 20110124 (prerelease)

How reproducible:
Always.

Steps to Reproduce:
struct Alpha
{
  virtual void x() { }
};
struct Derived : public Alpha
{
} v;

Actual results:
FAIL:
 <2><41>: Abbrev Number: 3 (DW_TAG_inheritance)
    <42>   DW_AT_type        : <0x70>   
    <46>   DW_AT_data_member_location: 0        

Expected results:
PASS:
 <2><41>: Abbrev Number: 3 (DW_TAG_inheritance)
    <42>   DW_AT_type        : <0x70>   
    <46>   DW_AT_data_member_location: 0        
    <47>   DW_AT_accessibility: 1       (public)

Additional info:
DWARF3:
An inheritance entry may have a DW_AT_accessibility attribute. If no accessibility attribute is present, private access is assumed for an entry of a class [...]

Affects at least:
gdb.cp/casts.exp

Comment 1 Jakub Jelinek 2011-01-24 10:16:06 UTC
You've omitted the important following words:
An inheritance entry may have a DW_AT_accessibility attribute. If no accessibility attribute is present, private access is assumed for an entry of a class and public access is assumed for an entry of an interface, struct or union.

The rule used by GCC now for -gdwarf-3 and above is the default is the natural choice for the language in question, i.e. if source doesn't need explicit public: or private:, then no DW_AT_accessibility is used.  For -gdwarf-2 the old behavior has been preserved.
See http://gcc.gnu.org/PR45124

Upstream GCC behaves exactly the same, the only difference is that GCC 4.6-RH defaults to -gdwarf-3, while GCC 4.6 upstream defaults still to -gdwarf-2.