public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug debug/51410] New: duplicate variable DIE
@ 2011-12-04 16:35 mark at gcc dot gnu.org
  2011-12-05  9:35 ` [Bug debug/51410] [4.5/4.6/4.7 Regression] " rguenth at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: mark at gcc dot gnu.org @ 2011-12-04 16:35 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 51410
           Summary: duplicate variable DIE
    Classification: Unclassified
           Product: gcc
           Version: 4.6.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: debug
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: mark@gcc.gnu.org
                CC: tromey@redhat.com


This used to confuse systemtap, it has been fixed by searching the symbol table
to find the address of a variable if no location description is available if
the var DIE is marked external. It can certainly be argued that systemtap
should just search harder and find the other var DIE that does contain a
location description. But it sure is confusing IMHO.

Given the following source code:

int x;

int main(int argc, char **argv)
{
  return x;
}

compiled with gcc (GCC) 4.6.1 20110908 (Red Hat 4.6.1-9)
$ gcc -g -O2 -o /tmp/x x.c

produces the following .debug_info:

DWARF section [28] '.debug_info' at offset 0x6a5:
 [Offset]
 Compilation unit at offset 0:
 Version: 3, Abbreviation section offset: 0, Address size: 4, Offset size: 4
 [     b]  compile_unit
           producer             (strp) "GNU C 4.6.1 20110908 (Red Hat 4.6.1-9)"
           language             (data1) ISO C89 (1)
           name                 (string) "x.c"
           comp_dir             (strp) "/home/mark/src/tests"
           ranges               (data4) range list [     0]
           low_pc               (addr) 0000000000
           entry_pc             (addr) 0000000000
           stmt_list            (data4) 0
 [    29]    subprogram
             external             (flag) Yes
             name                 (strp) "main"
             decl_file            (data1) 1
             decl_line            (data1) 3
             prototyped           (flag) Yes
             type                 (ref4) [    61]
             low_pc               (addr) 0x080482e0 <main>
             high_pc              (addr) 0x080482e6
             frame_base           (block1)               [   0] call_frame_cfa
             sibling              (ref4) [    61]
 [    44]      formal_parameter
               name                 (strp) "argc"
               decl_file            (data1) 1
               decl_line            (data1) 3
               type                 (ref4) [    61]
               location             (block1)                 [   0] fbreg 0
 [    52]      formal_parameter
               name                 (strp) "argv"
               decl_file            (data1) 1
               decl_line            (data1) 3
               type                 (ref4) [    68]
               location             (block1)                 [   0] fbreg 4
 [    61]    base_type
             byte_size            (data1) 4
             encoding             (data1) signed (5)
             name                 (string) "int"
 [    68]    pointer_type
             byte_size            (data1) 4
             type                 (ref4) [    6e]
 [    6e]    pointer_type
             byte_size            (data1) 4
             type                 (ref4) [    74]
 [    74]    base_type
             byte_size            (data1) 1
             encoding             (data1) signed_char (6)
             name                 (strp) "char"
 [    7b]    variable
             name                 (string) "x"
             decl_file            (data1) 1
             decl_line            (data1) 1
             type                 (ref4) [    61]
             external             (flag) Yes
             declaration          (flag) Yes
 [    86]    variable
             name                 (string) "x"
             decl_file            (data1) 1
             decl_line            (data1) 1
             type                 (ref4) [    61]
             external             (flag) Yes
             location             (block1)               [   0] addr 0x8049634
<x>

Note that there are two variable DIEs for x, 7b and 86, neither of which is
references in the rest of the CU. Since 86 doesn't refer to 7b, it isn't clear
to me how a consumer can know this is the same variable. In any case it seems
redundant to have both, even if the consumer is supposed to discard the one
marked as declaration.

This isn't an issue for static variables, which will have only one var DIE. It
is also a regression compared to gcc (GCC) 4.1.2 20080704 (Red Hat 4.1.2-51)
which would produce only one variable DIE for x.


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

* [Bug debug/51410] [4.5/4.6/4.7 Regression] duplicate variable DIE
  2011-12-04 16:35 [Bug debug/51410] New: duplicate variable DIE mark at gcc dot gnu.org
@ 2011-12-05  9:35 ` rguenth at gcc dot gnu.org
  2011-12-05 17:13 ` jakub at gcc dot gnu.org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-12-05  9:35 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Guenther <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |wrong-debug
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2011-12-05
      Known to work|                            |4.3.6, 4.4.6
   Target Milestone|---                         |4.5.4
            Summary|duplicate variable DIE      |[4.5/4.6/4.7 Regression]
                   |                            |duplicate variable DIE
     Ever Confirmed|0                           |1

--- Comment #1 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-12-05 09:34:29 UTC ---
Confirmed.  Fails since 4.5.0.


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

* [Bug debug/51410] [4.5/4.6/4.7 Regression] duplicate variable DIE
  2011-12-04 16:35 [Bug debug/51410] New: duplicate variable DIE mark at gcc dot gnu.org
  2011-12-05  9:35 ` [Bug debug/51410] [4.5/4.6/4.7 Regression] " rguenth at gcc dot gnu.org
@ 2011-12-05 17:13 ` jakub at gcc dot gnu.org
  2011-12-05 20:51 ` jakub at gcc dot gnu.org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: jakub at gcc dot gnu.org @ 2011-12-05 17:13 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
         AssignedTo|unassigned at gcc dot       |jakub at gcc dot gnu.org
                   |gnu.org                     |

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-12-05 17:13:10 UTC ---
Created attachment 25994
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=25994
gcc47-pr51410.patch

Untested fix.


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

* [Bug debug/51410] [4.5/4.6/4.7 Regression] duplicate variable DIE
  2011-12-04 16:35 [Bug debug/51410] New: duplicate variable DIE mark at gcc dot gnu.org
  2011-12-05  9:35 ` [Bug debug/51410] [4.5/4.6/4.7 Regression] " rguenth at gcc dot gnu.org
  2011-12-05 17:13 ` jakub at gcc dot gnu.org
@ 2011-12-05 20:51 ` jakub at gcc dot gnu.org
  2011-12-05 21:03 ` [Bug debug/51410] [4.5/4.6 " jakub at gcc dot gnu.org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: jakub at gcc dot gnu.org @ 2011-12-05 20:51 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-12-05 20:51:10 UTC ---
Author: jakub
Date: Mon Dec  5 20:51:07 2011
New Revision: 182027

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=182027
Log:
    PR debug/51410
    * c-decl.c (pop_scope): Don't add DECL_EXTERNAL decls
    for debug info if scope is file_scope.

    * gcc.dg/debug/dwarf2/pr51410.c: New test.

Added:
    trunk/gcc/testsuite/gcc.dg/debug/dwarf2/pr51410.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/c-decl.c
    trunk/gcc/testsuite/ChangeLog


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

* [Bug debug/51410] [4.5/4.6 Regression] duplicate variable DIE
  2011-12-04 16:35 [Bug debug/51410] New: duplicate variable DIE mark at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2011-12-05 20:51 ` jakub at gcc dot gnu.org
@ 2011-12-05 21:03 ` jakub at gcc dot gnu.org
  2011-12-08 13:42 ` jakub at gcc dot gnu.org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: jakub at gcc dot gnu.org @ 2011-12-05 21:03 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[4.5/4.6/4.7 Regression]    |[4.5/4.6 Regression]
                   |duplicate variable DIE      |duplicate variable DIE

--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-12-05 21:02:58 UTC ---
Fixed on the trunk so far.


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

* [Bug debug/51410] [4.5/4.6 Regression] duplicate variable DIE
  2011-12-04 16:35 [Bug debug/51410] New: duplicate variable DIE mark at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2011-12-05 21:03 ` [Bug debug/51410] [4.5/4.6 " jakub at gcc dot gnu.org
@ 2011-12-08 13:42 ` jakub at gcc dot gnu.org
  2012-06-20 13:10 ` [Bug debug/51410] [4.5 " rguenth at gcc dot gnu.org
  2012-07-02 10:18 ` rguenth at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: jakub at gcc dot gnu.org @ 2011-12-08 13:42 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-12-08 13:39:38 UTC ---
Author: jakub
Date: Thu Dec  8 13:39:34 2011
New Revision: 182114

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=182114
Log:
    Backport from mainline
    2011-12-05  Jakub Jelinek  <jakub@redhat.com>

    PR debug/51410
    * c-decl.c (pop_scope): Don't add DECL_EXTERNAL decls
    for debug info if scope is file_scope.

    * gcc.dg/debug/dwarf2/pr51410.c: New test.

Added:
    branches/gcc-4_6-branch/gcc/testsuite/gcc.dg/debug/dwarf2/pr51410.c
Modified:
    branches/gcc-4_6-branch/gcc/ChangeLog
    branches/gcc-4_6-branch/gcc/c-decl.c
    branches/gcc-4_6-branch/gcc/testsuite/ChangeLog


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

* [Bug debug/51410] [4.5 Regression] duplicate variable DIE
  2011-12-04 16:35 [Bug debug/51410] New: duplicate variable DIE mark at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2011-12-08 13:42 ` jakub at gcc dot gnu.org
@ 2012-06-20 13:10 ` rguenth at gcc dot gnu.org
  2012-07-02 10:18 ` rguenth at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-06-20 13:10 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Guenther <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P2


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

* [Bug debug/51410] [4.5 Regression] duplicate variable DIE
  2011-12-04 16:35 [Bug debug/51410] New: duplicate variable DIE mark at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2012-06-20 13:10 ` [Bug debug/51410] [4.5 " rguenth at gcc dot gnu.org
@ 2012-07-02 10:18 ` rguenth at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-07-02 10:18 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Guenther <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|4.5.4                       |4.6.3

--- Comment #6 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-07-02 10:18:20 UTC ---
Fixed in 4.6.3.


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

end of thread, other threads:[~2012-07-02 10:18 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-12-04 16:35 [Bug debug/51410] New: duplicate variable DIE mark at gcc dot gnu.org
2011-12-05  9:35 ` [Bug debug/51410] [4.5/4.6/4.7 Regression] " rguenth at gcc dot gnu.org
2011-12-05 17:13 ` jakub at gcc dot gnu.org
2011-12-05 20:51 ` jakub at gcc dot gnu.org
2011-12-05 21:03 ` [Bug debug/51410] [4.5/4.6 " jakub at gcc dot gnu.org
2011-12-08 13:42 ` jakub at gcc dot gnu.org
2012-06-20 13:10 ` [Bug debug/51410] [4.5 " rguenth at gcc dot gnu.org
2012-07-02 10:18 ` rguenth 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).