Bug 497405

Summary: Incorrect debug info for typedef statements within namespaces
Product: [Fedora] Fedora Reporter: Sami Wagiaalla <swagiaal>
Component: gccAssignee: Jakub Jelinek <jakub>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: low    
Version: 11CC: dodji, jakub, jan.kratochvil, keiths, mmcgrath
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2009-06-16 15:17:12 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:
Attachments:
Description Flags
candidate fix none

Description Sami Wagiaalla 2009-04-23 19:05:15 UTC
The following program:

namespace A{

  class B{
  };

  typedef A::B AB;
}

int main(){
  A::AB	ab;
  return 0;
}

compiled with gcc generates the following debug info:
 ...
 <1><43>: Abbrev Number: 5 (DW_TAG_subprogram)
    <44>   DW_AT_external    : 1        
    <45>   DW_AT_name        : (indirect string, offset: 0x4c): main    
    <49>   DW_AT_decl_file   : 1        
    <4a>   DW_AT_decl_line   : 10       
    <4b>   DW_AT_type        : <0x91>   
    <4f>   DW_AT_low_pc      : 0x40053c 
    <57>   DW_AT_high_pc     : 0x400547 
    <5f>   DW_AT_frame_base  : 0x0      (location list)
    <63>   DW_AT_sibling     : <0x91>   
 <2><67>: Abbrev Number: 6 (DW_TAG_lexical_block)
    <68>   DW_AT_low_pc      : 0x400540 
    <70>   DW_AT_high_pc     : 0x400545 
 <3><78>: Abbrev Number: 7 (DW_TAG_typedef)
    <79>   DW_AT_name        : AB       
    <7c>   DW_AT_decl_file   : 1        
    <7d>   DW_AT_decl_line   : 7        
    <7e>   DW_AT_type        : <0x3b>   
...

The typedef tag <78> is a child of subprogram main instead of
namespace A.

Comment 1 Dodji Seketeli 2009-05-11 16:08:35 UTC
Created attachment 343473 [details]
candidate fix

I am testing this patch for now.

I couldn't find a way to easily catch that issue in a regression test in 
gcc right now, because I need to test that the DIE of the typedef is properly nested in the right namespace.

I guess I will have to run the gdb testsuite as well, hoping to have a regression test that can catch the issue there.

Comment 2 Dodji Seketeli 2009-05-11 18:12:23 UTC
Okay the patch seems to bootstrap/regtest fine on gcc trunk.

Comment 3 Dodji Seketeli 2009-05-18 19:28:27 UTC
So I have opened an upstream bug at http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40109.

Comment 4 Dodji Seketeli 2009-05-18 19:32:09 UTC
Okay the upstream bug has been fixed. I guess I can't close this bug until a fedora package containing the fix is pushed.

So I am unassigning myself from the bug and passing the ball to Jakub :)

Comment 5 Bug Zapper 2009-06-09 14:28:48 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 11 development cycle.
Changing version to '11'.

More information and reason for this action is here:
http://fedoraproject.org/wiki/BugZappers/HouseKeeping