public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug debug/46973] New: DW_TAG_structure_type can loose its DW_TAG_template{type,value}_param et al children
@ 2010-12-15 21:23 dodji at gcc dot gnu.org
  2010-12-15 21:24 ` [Bug debug/46973] " dodji at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: dodji at gcc dot gnu.org @ 2010-12-15 21:23 UTC (permalink / raw)
  To: gcc-bugs

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

           Summary: DW_TAG_structure_type can loose its
                    DW_TAG_template{type,value}_param et al children
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: debug
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: dodji@gcc.gnu.org


Consider this attachment: http://gcc.gnu.org/bugzilla/attachment.cgi?id=21610

The resulting DWARF yields good results for Base<double, ...>:

 <1><47>: Abbrev Number: 5 (DW_TAG_structure_type)
    <48>   DW_AT_name        : (indirect string, offset: 0x43): Base<double,
23, (& a_global), &S::f>    
    <4c>   DW_AT_byte_size   : 1    
    <4d>   DW_AT_decl_file   : 1    
    <4e>   DW_AT_decl_line   : 29    
    <4f>   DW_AT_sibling     : <0xb4>    
 <2><53>: Abbrev Number: 6 (DW_TAG_template_type_param)
    <54>   DW_AT_name        : T    
    <56>   DW_AT_type        : <0xb4>    
[...]


But for Base<long, ...>, not so much. It is missing all the template parameters
and arguments:

 <1><d0>: Abbrev Number: 5 (DW_TAG_structure_type)
    <d1>   DW_AT_name        : (indirect string, offset: 0x191): Base<long int,
47, (& a_global), &S::f>    
    <d5>   DW_AT_byte_size   : 1    
    <d6>   DW_AT_decl_file   : 1    
    <d7>   DW_AT_decl_line   : 29    
    <d8>   DW_AT_sibling     : <0x105>    
 <2><dc>: Abbrev Number: 16 (DW_TAG_structure_type)
    <dd>   DW_AT_name        : (indirect string, offset: 0x157): Inner<float>   
    <e1>   DW_AT_byte_size   : 1    
    <e2>   DW_AT_decl_file   : 1    
    <e3>   DW_AT_decl_line   : 32    
 <3><e4>: Abbrev Number: 6 (DW_TAG_template_type_param)
    <e5>   DW_AT_name        : Z    
    <e7>   DW_AT_type        : <0x10c>    
 <3><eb>: Abbrev Number: 12 (DW_TAG_subprogram)
    <ec>   DW_AT_external    : 1    
    <ed>   DW_AT_name        : (indirect string, offset: 0xa8): inner_m    
    <f1>   DW_AT_decl_file   : 1    
    <f2>   DW_AT_decl_line   : 34    
    <f3>   DW_AT_MIPS_linkage_name: (indirect string, offset: 0xb0):
_ZN4BaseIlLi47EXadL_Z8a_globalEEXadL_ZN1S1fEEEE5InnerIfE7inner_mEv    
    <f7>   DW_AT_declaration : 1    
    <f8>   DW_AT_object_pointer: <0xfc>    
 <4><fc>: Abbrev Number: 11 (DW_TAG_formal_parameter)
    <fd>   DW_AT_type        : <0x113>    
    <101>   DW_AT_artificial  : 1

This has been filed as a comment for bug debug/41736, but I am creating this PR
instead as the bug is slightly different.

Here is what I think is happening. The template parms/args children DIEs of the
DW_TAG_structure_type of  Base<long int, 47, (& a_global), &S::f> are not
marked [and that's the bug] as being used so they are not emitted.

The type Base<long, 47, &a_global, &S::f> itself is not used directly. The type
that is used is Base<long, 47, &a_global, &S::f>::Inner<float>.
So prune_unused_types_mark marks the DIE of Base<long, 47, &a_global,
&S::f>::Inner<float> as being used; it also marks the parent DIE as used. That
is, it marks the DW_TAG_structure_type DIE of Base<long, 47, &a_global, &S::f>
as being used. But it marks that DW_TAG_structure_type DIE *only* (along with
its attributes. Not its children DIEs -- so it forgets to mark the
DW_TAG_template{type,value}_param children DIEs as well.

I think the purpose of marking the parent DIE of the DW_TAG_structure_type of
Base<long, 47, &a_global, &S::f>::Inner<float> as used is just to define the
names space it belongs to. So it is generally fine to avoid emitting the
children DIEs of that parent DIE -- unless some of those children DIEs
participate in defining the name space Base<long, 47, &a_global,
&S::f>::Inner<float> belongs to. And we are in this corner case here.

I believe this depends on PR debug/46955 because once we stop forgetting the
DW_TAG_template_value DIEs, we must properly emit its DW_AT_const_value
attribute.


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

* [Bug debug/46973] DW_TAG_structure_type can loose its DW_TAG_template{type,value}_param et al children
  2010-12-15 21:23 [Bug debug/46973] New: DW_TAG_structure_type can loose its DW_TAG_template{type,value}_param et al children dodji at gcc dot gnu.org
@ 2010-12-15 21:24 ` dodji at gcc dot gnu.org
  2010-12-16 17:08 ` dodji at gcc dot gnu.org
  2011-01-13 15:23 ` dodji at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: dodji at gcc dot gnu.org @ 2010-12-15 21:24 UTC (permalink / raw)
  To: gcc-bugs

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

Dodji Seketeli <dodji at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2010.12.15 21:24:45
         Depends on|                            |46955
     Ever Confirmed|0                           |1


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

* [Bug debug/46973] DW_TAG_structure_type can loose its DW_TAG_template{type,value}_param et al children
  2010-12-15 21:23 [Bug debug/46973] New: DW_TAG_structure_type can loose its DW_TAG_template{type,value}_param et al children dodji at gcc dot gnu.org
  2010-12-15 21:24 ` [Bug debug/46973] " dodji at gcc dot gnu.org
@ 2010-12-16 17:08 ` dodji at gcc dot gnu.org
  2011-01-13 15:23 ` dodji at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: dodji at gcc dot gnu.org @ 2010-12-16 17:08 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Dodji Seketeli <dodji at gcc dot gnu.org> 2010-12-16 17:08:34 UTC ---
Candidate patch posted to
http://gcc.gnu.org/ml/gcc-patches/2010-12/msg01277.html


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

* [Bug debug/46973] DW_TAG_structure_type can loose its DW_TAG_template{type,value}_param et al children
  2010-12-15 21:23 [Bug debug/46973] New: DW_TAG_structure_type can loose its DW_TAG_template{type,value}_param et al children dodji at gcc dot gnu.org
  2010-12-15 21:24 ` [Bug debug/46973] " dodji at gcc dot gnu.org
  2010-12-16 17:08 ` dodji at gcc dot gnu.org
@ 2011-01-13 15:23 ` dodji at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: dodji at gcc dot gnu.org @ 2011-01-13 15:23 UTC (permalink / raw)
  To: gcc-bugs

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

Dodji Seketeli <dodji at gcc dot gnu.org> changed:

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

--- Comment #2 from Dodji Seketeli <dodji at gcc dot gnu.org> 2011-01-13 13:45:44 UTC ---
Fixed in trunk (4.6).


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

end of thread, other threads:[~2011-01-13 13:46 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-12-15 21:23 [Bug debug/46973] New: DW_TAG_structure_type can loose its DW_TAG_template{type,value}_param et al children dodji at gcc dot gnu.org
2010-12-15 21:24 ` [Bug debug/46973] " dodji at gcc dot gnu.org
2010-12-16 17:08 ` dodji at gcc dot gnu.org
2011-01-13 15:23 ` dodji 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).