public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug debug/40573]  New: [4.4/4.5 Regression] DWARF for inlined subroutines refers to the outlined copy
@ 2009-06-27 22:11 drow at gcc dot gnu dot org
  2009-06-27 22:13 ` [Bug debug/40573] " drow at gcc dot gnu dot org
                   ` (11 more replies)
  0 siblings, 12 replies; 13+ messages in thread
From: drow at gcc dot gnu dot org @ 2009-06-27 22:11 UTC (permalink / raw)
  To: gcc-bugs

In the attached testcase (which will be added to the GDB testsuite), func1 is
both emitted as a function and inlined into main and func2.  The generated
DWARF output looks like this with mainline:

 <1><1bf>: Abbrev Number: 2 (DW_TAG_subprogram)
    <1c0>   DW_AT_external    : 1
    <1c1>   DW_AT_name        : (indirect string, offset: 0x11b): func1
    <1c5>   DW_AT_decl_file   : 1
    <1c6>   DW_AT_decl_line   : 22
    <1c7>   DW_AT_prototyped  : 1
    <1c8>   DW_AT_type        : <0x1e8>
    <1cc>   DW_AT_inline      : 3       (declared as inline and inlined)
    <1cd>   DW_AT_sibling     : <0x1e8>
 <2><1d1>: Abbrev Number: 3 (DW_TAG_formal_parameter)
    <1d2>   DW_AT_name        : (indirect string, offset: 0x10c): arg1
    <1d6>   DW_AT_decl_file   : 1
    <1d7>   DW_AT_decl_line   : 22
    <1d8>   DW_AT_type        : <0x1e8>

 <1><202>: Abbrev Number: 9 (DW_TAG_subprogram)
    <203>   DW_AT_abstract_origin: <0x1bf>
    <207>   DW_AT_low_pc      : 0x4004a0
    <20f>   DW_AT_high_pc     : 0x4004e8
    <217>   DW_AT_frame_base  : 0x0     (location list)
    <21b>   DW_AT_sibling     : <0x230>
 <2><21f>: Abbrev Number: 10 (DW_TAG_formal_parameter)
    <220>   DW_AT_abstract_origin: <0x1d1>
    <224>   DW_AT_location    : 1 byte block: 53        (DW_OP_reg3)

 <2><272>: Abbrev Number: 12 (DW_TAG_inlined_subroutine)
    <273>   DW_AT_abstract_origin: <0x1bf>
    <277>   DW_AT_entry_pc    : 0x4004fa
    <27f>   DW_AT_ranges      : 0x50
    <283>   DW_AT_call_file   : 1
    <284>   DW_AT_call_line   : 34
 <3><285>: Abbrev Number: 13 (DW_TAG_formal_parameter)
    <286>   DW_AT_abstract_origin: <0x21f>

The problem is that the abstract origin of arg1 in the inlined copy (DIE at
0x285) refers to the outlined copy.  But this is not in the abstract subtree
referred to by the DIE at 0x272.

Two things go wrong in consequence.  GDB concludes that nothing in this subtree
refers to the DIE at 0x1d1 and stitches that DIE into the tree, resulting in a
second copy of arg1 (with no DW_AT_location).  This could be worked around in
GDB to compensate for the DWARF, but I'm convinced from the DWARF spec that the
nesting is invalid.  The other thing that goes wrong is even with the
workaround, we try to use the DW_AT_location from the outlined copy.  It works
by chance in 4.5; in 4.4 a location list was used instead of a register, so of
course the PC values in the location list do not apply.

Honza, Richi suggested on IRC that this might be related to your changes in
inline variable tracking.  Any idea?


-- 
           Summary: [4.4/4.5 Regression] DWARF for inlined subroutines
                    refers to the outlined copy
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: debug
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: drow at gcc dot gnu dot org


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


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

* [Bug debug/40573] [4.4/4.5 Regression] DWARF for inlined subroutines refers to the outlined copy
  2009-06-27 22:11 [Bug debug/40573] New: [4.4/4.5 Regression] DWARF for inlined subroutines refers to the outlined copy drow at gcc dot gnu dot org
@ 2009-06-27 22:13 ` drow at gcc dot gnu dot org
  2009-06-28 11:02 ` rguenth at gcc dot gnu dot org
                   ` (10 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: drow at gcc dot gnu dot org @ 2009-06-27 22:13 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from drow at gcc dot gnu dot org  2009-06-27 22:12 -------
Created an attachment (id=18083)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=18083&action=view)
Test case

Compile with -O2.


-- 


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


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

* [Bug debug/40573] [4.4/4.5 Regression] DWARF for inlined subroutines refers to the outlined copy
  2009-06-27 22:11 [Bug debug/40573] New: [4.4/4.5 Regression] DWARF for inlined subroutines refers to the outlined copy drow at gcc dot gnu dot org
  2009-06-27 22:13 ` [Bug debug/40573] " drow at gcc dot gnu dot org
@ 2009-06-28 11:02 ` rguenth at gcc dot gnu dot org
  2009-06-30 13:59 ` jakub at gcc dot gnu dot org
                   ` (9 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-06-28 11:02 UTC (permalink / raw)
  To: gcc-bugs



-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |wrong-debug
   Target Milestone|---                         |4.4.1


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


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

* [Bug debug/40573] [4.4/4.5 Regression] DWARF for inlined subroutines refers to the outlined copy
  2009-06-27 22:11 [Bug debug/40573] New: [4.4/4.5 Regression] DWARF for inlined subroutines refers to the outlined copy drow at gcc dot gnu dot org
  2009-06-27 22:13 ` [Bug debug/40573] " drow at gcc dot gnu dot org
  2009-06-28 11:02 ` rguenth at gcc dot gnu dot org
@ 2009-06-30 13:59 ` jakub at gcc dot gnu dot org
  2009-06-30 14:07 ` hubicka at ucw dot cz
                   ` (8 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: jakub at gcc dot gnu dot org @ 2009-06-30 13:59 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from jakub at gcc dot gnu dot org  2009-06-30 13:59 -------
Is this really a regression?  GCC 3.4.x, 4.0.x, 4.1.x, 4.2.x, 4.3.x emit the
same thing?


-- 


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


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

* [Bug debug/40573] [4.4/4.5 Regression] DWARF for inlined subroutines refers to the outlined copy
  2009-06-27 22:11 [Bug debug/40573] New: [4.4/4.5 Regression] DWARF for inlined subroutines refers to the outlined copy drow at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2009-06-30 13:59 ` jakub at gcc dot gnu dot org
@ 2009-06-30 14:07 ` hubicka at ucw dot cz
  2009-06-30 14:20 ` [Bug debug/40573] " drow at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: hubicka at ucw dot cz @ 2009-06-30 14:07 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from hubicka at ucw dot cz  2009-06-30 14:07 -------
Subject: Re:  [4.4/4.5 Regression] DWARF for inlined subroutines refers to the
outlined copy

Hmm, I tought GCC was doing the same thing for years.  So we need
abstract function for each inline?

Honza


-- 


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


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

* [Bug debug/40573] DWARF for inlined subroutines refers to the outlined copy
  2009-06-27 22:11 [Bug debug/40573] New: [4.4/4.5 Regression] DWARF for inlined subroutines refers to the outlined copy drow at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2009-06-30 14:07 ` hubicka at ucw dot cz
@ 2009-06-30 14:20 ` drow at gcc dot gnu dot org
  2009-06-30 14:21 ` drow at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: drow at gcc dot gnu dot org @ 2009-06-30 14:20 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from drow at gcc dot gnu dot org  2009-06-30 14:19 -------
It looks like you're right.  Jan K. recently added support to GDB to attach the
unreferenced children of abstract DIEs to each concrete instance, and that
caused my existing test case to fail in a new way.


-- 

drow at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[4.4/4.5 Regression] DWARF  |DWARF for inlined
                   |for inlined subroutines     |subroutines refers to the
                   |refers to the outlined copy |outlined copy


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


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

* [Bug debug/40573] DWARF for inlined subroutines refers to the outlined copy
  2009-06-27 22:11 [Bug debug/40573] New: [4.4/4.5 Regression] DWARF for inlined subroutines refers to the outlined copy drow at gcc dot gnu dot org
                   ` (4 preceding siblings ...)
  2009-06-30 14:20 ` [Bug debug/40573] " drow at gcc dot gnu dot org
@ 2009-06-30 14:21 ` drow at gcc dot gnu dot org
  2009-06-30 16:29 ` jakub at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: drow at gcc dot gnu dot org @ 2009-06-30 14:21 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from drow at gcc dot gnu dot org  2009-06-30 14:21 -------
(In reply to comment #3)
> Hmm, I tought GCC was doing the same thing for years.  So we need
> abstract function for each inline?

Why?  I think we each inlined copy (and the outlined copy) to refer to the one
abstract copy.  The problem is the links from the inlined copies to the
outlined copy.

Meanwhile I'll try to work around this in GDB.


-- 


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


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

* [Bug debug/40573] DWARF for inlined subroutines refers to the outlined copy
  2009-06-27 22:11 [Bug debug/40573] New: [4.4/4.5 Regression] DWARF for inlined subroutines refers to the outlined copy drow at gcc dot gnu dot org
                   ` (5 preceding siblings ...)
  2009-06-30 14:21 ` drow at gcc dot gnu dot org
@ 2009-06-30 16:29 ` jakub at gcc dot gnu dot org
  2009-06-30 17:52 ` drow at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: jakub at gcc dot gnu dot org @ 2009-06-30 16:29 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from jakub at gcc dot gnu dot org  2009-06-30 16:29 -------
Created an attachment (id=18101)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=18101&action=view)
gcc45-pr40573.patch

Does this patch do what you wanted to see?


-- 


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


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

* [Bug debug/40573] DWARF for inlined subroutines refers to the outlined copy
  2009-06-27 22:11 [Bug debug/40573] New: [4.4/4.5 Regression] DWARF for inlined subroutines refers to the outlined copy drow at gcc dot gnu dot org
                   ` (6 preceding siblings ...)
  2009-06-30 16:29 ` jakub at gcc dot gnu dot org
@ 2009-06-30 17:52 ` drow at gcc dot gnu dot org
  2009-06-30 18:13 ` jakub at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: drow at gcc dot gnu dot org @ 2009-06-30 17:52 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from drow at gcc dot gnu dot org  2009-06-30 17:52 -------
Subject: Re:  DWARF for inlined subroutines refers to the
 outlined copy

On Tue, Jun 30, 2009 at 04:29:25PM -0000, jakub at gcc dot gnu dot org wrote:
> 
> 
> ------- Comment #6 from jakub at gcc dot gnu dot org  2009-06-30 16:29 -------
> Created an attachment (id=18101)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=18101&action=view)
>  --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=18101&action=view)
> gcc45-pr40573.patch
> 
> Does this patch do what you wanted to see?

No changes in the (patched to handle earlier GCC) GDB testsuite -
good.  No visible changes in the testcase DWARF either - bad.

 <2><1a6>: Abbrev Number: 3 (DW_TAG_formal_parameter)
    <1a7>   DW_AT_name        : (indirect string, offset: 0xcc): arg1
    <1ab>   DW_AT_decl_file   : 1
    <1ac>   DW_AT_decl_line   : 22
    <1ad>   DW_AT_type        : <0x1bd>

 <2><1f4>: Abbrev Number: 10 (DW_TAG_formal_parameter)
    <1f5>   DW_AT_abstract_origin: <0x1a6>
    <1f9>   DW_AT_location    : 1 byte block: 53        (DW_OP_reg3)

 <4><2f7>: Abbrev Number: 13 (DW_TAG_formal_parameter)
    <2f8>   DW_AT_abstract_origin: <0x1f4>

should be <0x1a6>.


-- 


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


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

* [Bug debug/40573] DWARF for inlined subroutines refers to the outlined copy
  2009-06-27 22:11 [Bug debug/40573] New: [4.4/4.5 Regression] DWARF for inlined subroutines refers to the outlined copy drow at gcc dot gnu dot org
                   ` (7 preceding siblings ...)
  2009-06-30 17:52 ` drow at gcc dot gnu dot org
@ 2009-06-30 18:13 ` jakub at gcc dot gnu dot org
  2009-06-30 18:59 ` drow at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: jakub at gcc dot gnu dot org @ 2009-06-30 18:13 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from jakub at gcc dot gnu dot org  2009-06-30 18:13 -------
Created an attachment (id=18102)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=18102&action=view)
diff

Weird, the difference I get with the patch on the testcase at -O2 -g is
attached.


-- 


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


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

* [Bug debug/40573] DWARF for inlined subroutines refers to the outlined copy
  2009-06-27 22:11 [Bug debug/40573] New: [4.4/4.5 Regression] DWARF for inlined subroutines refers to the outlined copy drow at gcc dot gnu dot org
                   ` (8 preceding siblings ...)
  2009-06-30 18:13 ` jakub at gcc dot gnu dot org
@ 2009-06-30 18:59 ` drow at gcc dot gnu dot org
  2009-06-30 22:04 ` jakub at gcc dot gnu dot org
  2009-06-30 22:41 ` jakub at gcc dot gnu dot org
  11 siblings, 0 replies; 13+ messages in thread
From: drow at gcc dot gnu dot org @ 2009-06-30 18:59 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #9 from drow at gcc dot gnu dot org  2009-06-30 18:59 -------
Subject: Re:  DWARF for inlined subroutines refers to the
 outlined copy

On Tue, Jun 30, 2009 at 06:13:16PM -0000, jakub at gcc dot gnu dot org wrote:
> Weird, the difference I get with the patch on the testcase at -O2 -g is
> attached.

You're right, my test run was foobar.  Your patch causes this:

-arg1 = 0
-(gdb) PASS: gdb.opt/inline-locals.exp: info args above bar (2)
+arg1 = <value optimized out>
+(gdb) FAIL: gdb.opt/inline-locals.exp: info args above bar (2)

Despite the appearance, this is good.  The previous result was luck, a
DW_AT_location in the out-of-line instance that used the same register
as in the inlined instance.  I hope VTA will fix this failure.


-- 


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


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

* [Bug debug/40573] DWARF for inlined subroutines refers to the outlined copy
  2009-06-27 22:11 [Bug debug/40573] New: [4.4/4.5 Regression] DWARF for inlined subroutines refers to the outlined copy drow at gcc dot gnu dot org
                   ` (9 preceding siblings ...)
  2009-06-30 18:59 ` drow at gcc dot gnu dot org
@ 2009-06-30 22:04 ` jakub at gcc dot gnu dot org
  2009-06-30 22:41 ` jakub at gcc dot gnu dot org
  11 siblings, 0 replies; 13+ messages in thread
From: jakub at gcc dot gnu dot org @ 2009-06-30 22:04 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #10 from jakub at gcc dot gnu dot org  2009-06-30 22:03 -------
Subject: Bug 40573

Author: jakub
Date: Tue Jun 30 22:03:27 2009
New Revision: 149120

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=149120
Log:
        PR debug/40573
        * dwarf2out.c (gen_formal_parameter_die): Call
        equate_decl_number_to_die if node is different from origin.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/dwarf2out.c


-- 


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


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

* [Bug debug/40573] DWARF for inlined subroutines refers to the outlined copy
  2009-06-27 22:11 [Bug debug/40573] New: [4.4/4.5 Regression] DWARF for inlined subroutines refers to the outlined copy drow at gcc dot gnu dot org
                   ` (10 preceding siblings ...)
  2009-06-30 22:04 ` jakub at gcc dot gnu dot org
@ 2009-06-30 22:41 ` jakub at gcc dot gnu dot org
  11 siblings, 0 replies; 13+ messages in thread
From: jakub at gcc dot gnu dot org @ 2009-06-30 22:41 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #11 from jakub at gcc dot gnu dot org  2009-06-30 22:40 -------
Fixed on the trunk.


-- 

jakub at gcc dot gnu dot org changed:

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


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


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

end of thread, other threads:[~2009-06-30 22:41 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-06-27 22:11 [Bug debug/40573] New: [4.4/4.5 Regression] DWARF for inlined subroutines refers to the outlined copy drow at gcc dot gnu dot org
2009-06-27 22:13 ` [Bug debug/40573] " drow at gcc dot gnu dot org
2009-06-28 11:02 ` rguenth at gcc dot gnu dot org
2009-06-30 13:59 ` jakub at gcc dot gnu dot org
2009-06-30 14:07 ` hubicka at ucw dot cz
2009-06-30 14:20 ` [Bug debug/40573] " drow at gcc dot gnu dot org
2009-06-30 14:21 ` drow at gcc dot gnu dot org
2009-06-30 16:29 ` jakub at gcc dot gnu dot org
2009-06-30 17:52 ` drow at gcc dot gnu dot org
2009-06-30 18:13 ` jakub at gcc dot gnu dot org
2009-06-30 18:59 ` drow at gcc dot gnu dot org
2009-06-30 22:04 ` jakub at gcc dot gnu dot org
2009-06-30 22:41 ` jakub at gcc dot gnu dot 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).