public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug debug/39524]  New: Duplicite C++ DW_TAG_variable breaking its DW_AT_location resolution
@ 2009-03-23  8:50 jan dot kratochvil at redhat dot com
  2009-03-23 10:15 ` [Bug debug/39524] Duplicate " jakub at gcc dot gnu dot org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: jan dot kratochvil at redhat dot com @ 2009-03-23  8:50 UTC (permalink / raw)
  To: gcc-bugs

Tested on: GNU C++ 4.4.0 20090323 (experimental)    

Testcase:
------------------------------------------------------------------------------
namespace A
  {
    static int var2 = 2;
  }

int
func (void)
{
  using A::var2;

  return var2;
}
------------------------------------------------------------------------------
will generate (reduced):

 <1><2d>: Abbrev Number: 2 (DW_TAG_subprogram)
    <2f>   DW_AT_name        : (indirect string, offset: 0x42): func    
    <3d>   DW_AT_low_pc      : 0x0      
    <45>   DW_AT_high_pc     : 0xc      
    <4d>   DW_AT_frame_base  : 0x0      (location list)
 <2><55>: Abbrev Number: 3 (DW_TAG_lexical_block)
    <56>   DW_AT_low_pc      : 0x4      
    <5e>   DW_AT_high_pc     : 0xa      
 <3><66>: Abbrev Number: 4 (DW_TAG_imported_declaration)
    <69>   DW_AT_import      : <0x7f>   [Abbrev Number: 7 (DW_TAG_variable)]
 <1><76>: Abbrev Number: 6 (DW_TAG_namespace)
    <77>   DW_AT_name        : A        
 <2><7f>: Abbrev Number: 7 (DW_TAG_variable)
    <80>   DW_AT_name        : (indirect string, offset: 0x34): var2    
    <84>   DW_AT_decl_file   : 1        
    <85>   DW_AT_decl_line   : 3        
    <86>   DW_AT_type        : <0x6f>   
    <8a>   DW_AT_declaration : 1        
 <2><8b>: Abbrev Number: 7 (DW_TAG_variable)
    <8c>   DW_AT_name        : (indirect string, offset: 0x34): var2    
    <84>   DW_AT_decl_file   : 1        
    <85>   DW_AT_decl_line   : 3        
    <92>   DW_AT_type        : <0x6f>   
    <96>   DW_AT_declaration : 1        
 <1><98>: Abbrev Number: 8 (DW_TAG_variable)
    <99>   DW_AT_specification: <0x8b>  
    <9d>   DW_AT_location    : 9 byte block: 3 0 0 0 0 0 0 0 0  (DW_OP_addr: 0)

You can see the code references the <7f> "var" instance but DW_AT_location is
given by the <98> completion only for the <8b> "var" instance.

Also <7f> and <8b> have a name conflict as being in the same naming scope.

This problem causes a wrong evaluation by Archer archer-keiths-expr-cumulative
branch (which is IMO right) for the more complex testcase - as it cannot find
the right DW_AT_location there:
------------------------------------------------------------------------------
# archer-keiths-expr-cumulative=35ca449e9f1a4cd477df644f717bbe4e3362c486/gdb -q
./outer
(gdb) l 1
1       #include <stdlib.h>
2
3       namespace A
4         {
5           static int var = 2;
6         }
7
8       int
9       main (void)
10      {
11        int var = 1;
12      
13        if (var != 1)         /* var-is-1 */
14          abort ();
15      
16        {
17          using A::var;
18      
19          if (var != 2)       /* var-is-2 */
20            abort ();
21        }
22      
23        return 0;             /* break-here */
24      }
(gdb) b 13
Breakpoint 1 at 0x4005a7: file outer.C, line 13.
(gdb) r
Starting program: /tmp/outer 

Breakpoint 1, main () at outer.C:13
13        if (var != 1)         /* var-is-1 */
(gdb) p var
$1 = 1
(gdb) adv 19
main () at outer.C:19
19          if (var != 2)       /* var-is-2 */
(gdb) p var
$2 = 1
^^^^^^ Wrong GDB evaluation.
(gdb) adv 23
main () at outer.C:23
23        return 0;             /* break-here */
(gdb) q
------------------------------------------------------------------------------


-- 
           Summary: Duplicite C++ DW_TAG_variable breaking its
                    DW_AT_location resolution
           Product: gcc
           Version: 4.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: debug
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jan dot kratochvil at redhat dot com
GCC target triplet: x86_64-unknown-linux-gnu


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


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

* [Bug debug/39524] Duplicate C++ DW_TAG_variable breaking its DW_AT_location resolution
  2009-03-23  8:50 [Bug debug/39524] New: Duplicite C++ DW_TAG_variable breaking its DW_AT_location resolution jan dot kratochvil at redhat dot com
@ 2009-03-23 10:15 ` jakub at gcc dot gnu dot org
  2009-03-23 11:20 ` dodji at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: jakub at gcc dot gnu dot org @ 2009-03-23 10:15 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from jakub at gcc dot gnu dot org  2009-03-23 10:14 -------
Created an attachment (id=17517)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=17517&action=view)
gcc44-pr39524.patch

Could you please test this with gdb/archer testsuite?  I'm going to
bootstrap/regtest it in gcc in the mean time.


-- 

jakub at gcc dot gnu dot org changed:

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


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


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

* [Bug debug/39524] Duplicate C++ DW_TAG_variable breaking its DW_AT_location resolution
  2009-03-23  8:50 [Bug debug/39524] New: Duplicite C++ DW_TAG_variable breaking its DW_AT_location resolution jan dot kratochvil at redhat dot com
  2009-03-23 10:15 ` [Bug debug/39524] Duplicate " jakub at gcc dot gnu dot org
@ 2009-03-23 11:20 ` dodji at gcc dot gnu dot org
  2009-03-23 11:32 ` jan dot kratochvil at redhat dot com
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: dodji at gcc dot gnu dot org @ 2009-03-23 11:20 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from dodji at gcc dot gnu dot org  2009-03-23 11:20 -------
Created an attachment (id=17518)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=17518&action=view)
another candidate fix

I was looking at this bug when I saw Jakub's patch :)
After talking with Jakub a little bit I felt I could post attch the patch here
as well, before full regtest.

Jan, would it be possible to test this patch as well against your gdb
environment ? I have regtested it for the c++ FE, but it needs regtesting for
all the FEs I think.


-- 


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


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

* [Bug debug/39524] Duplicate C++ DW_TAG_variable breaking its DW_AT_location resolution
  2009-03-23  8:50 [Bug debug/39524] New: Duplicite C++ DW_TAG_variable breaking its DW_AT_location resolution jan dot kratochvil at redhat dot com
  2009-03-23 10:15 ` [Bug debug/39524] Duplicate " jakub at gcc dot gnu dot org
  2009-03-23 11:20 ` dodji at gcc dot gnu dot org
@ 2009-03-23 11:32 ` jan dot kratochvil at redhat dot com
  2009-03-23 13:52 ` jakub at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: jan dot kratochvil at redhat dot com @ 2009-03-23 11:32 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from jan dot kratochvil at redhat dot com  2009-03-23 11:32 -------
One fix should be enough next time, thanks.
Going to gdb-regression test both the patches (in Fedora GCC on Fedora 11).


-- 


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


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

* [Bug debug/39524] Duplicate C++ DW_TAG_variable breaking its DW_AT_location resolution
  2009-03-23  8:50 [Bug debug/39524] New: Duplicite C++ DW_TAG_variable breaking its DW_AT_location resolution jan dot kratochvil at redhat dot com
                   ` (2 preceding siblings ...)
  2009-03-23 11:32 ` jan dot kratochvil at redhat dot com
@ 2009-03-23 13:52 ` jakub at gcc dot gnu dot org
  2009-03-23 14:30 ` jakub at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: jakub at gcc dot gnu dot org @ 2009-03-23 13:52 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from jakub at gcc dot gnu dot org  2009-03-23 13:52 -------
Created an attachment (id=17520)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=17520&action=view)
gcc44-pr39524.patch

Modified Dodji's patch I've actually bootstrapped/regtested (neither of the
patches caused any regressions).  I've moved the test after Fortran COMMON
handling, there we update the DW_AT_location if it was missing before etc., and
added a check if the preexisting old_die is in the right context just to be
sure.


-- 


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


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

* [Bug debug/39524] Duplicate C++ DW_TAG_variable breaking its DW_AT_location resolution
  2009-03-23  8:50 [Bug debug/39524] New: Duplicite C++ DW_TAG_variable breaking its DW_AT_location resolution jan dot kratochvil at redhat dot com
                   ` (3 preceding siblings ...)
  2009-03-23 13:52 ` jakub at gcc dot gnu dot org
@ 2009-03-23 14:30 ` jakub at gcc dot gnu dot org
  2009-03-23 23:22 ` jakub at gcc dot gnu dot org
  2010-03-22 16:12 ` dodji at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: jakub at gcc dot gnu dot org @ 2009-03-23 14:30 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from jakub at gcc dot gnu dot org  2009-03-23 14:30 -------
Created an attachment (id=17521)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=17521&action=view)
gcc44-pr39524.patch

Argh, sorry, actually this patch, not the one I've attached in the previous
comment.


-- 

jakub at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #17520|0                           |1
        is obsolete|                            |


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


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

* [Bug debug/39524] Duplicate C++ DW_TAG_variable breaking its DW_AT_location resolution
  2009-03-23  8:50 [Bug debug/39524] New: Duplicite C++ DW_TAG_variable breaking its DW_AT_location resolution jan dot kratochvil at redhat dot com
                   ` (4 preceding siblings ...)
  2009-03-23 14:30 ` jakub at gcc dot gnu dot org
@ 2009-03-23 23:22 ` jakub at gcc dot gnu dot org
  2010-03-22 16:12 ` dodji at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: jakub at gcc dot gnu dot org @ 2009-03-23 23:22 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from jakub at gcc dot gnu dot org  2009-03-23 23:21 -------
Subject: Bug 39524

Author: jakub
Date: Mon Mar 23 23:21:38 2009
New Revision: 145018

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=145018
Log:
        PR debug/39524
        * dwarf2out.c (gen_variable_die): Avoid adding duplicate declaration
        nodes.

        * g++.dg/debug/dwarf2/imported-decl-1.C: New test.

Added:
    trunk/gcc/testsuite/g++.dg/debug/dwarf2/imported-decl-1.C
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/dwarf2out.c
    trunk/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug debug/39524] Duplicate C++ DW_TAG_variable breaking its DW_AT_location resolution
  2009-03-23  8:50 [Bug debug/39524] New: Duplicite C++ DW_TAG_variable breaking its DW_AT_location resolution jan dot kratochvil at redhat dot com
                   ` (5 preceding siblings ...)
  2009-03-23 23:22 ` jakub at gcc dot gnu dot org
@ 2010-03-22 16:12 ` dodji at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: dodji at gcc dot gnu dot org @ 2010-03-22 16:12 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from dodji at gcc dot gnu dot org  2010-03-22 16:11 -------
This got fixed in 4.4 but the PR never got closed. Closing now.


-- 

dodji at gcc dot gnu dot org changed:

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


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


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

end of thread, other threads:[~2010-03-22 16:12 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-03-23  8:50 [Bug debug/39524] New: Duplicite C++ DW_TAG_variable breaking its DW_AT_location resolution jan dot kratochvil at redhat dot com
2009-03-23 10:15 ` [Bug debug/39524] Duplicate " jakub at gcc dot gnu dot org
2009-03-23 11:20 ` dodji at gcc dot gnu dot org
2009-03-23 11:32 ` jan dot kratochvil at redhat dot com
2009-03-23 13:52 ` jakub at gcc dot gnu dot org
2009-03-23 14:30 ` jakub at gcc dot gnu dot org
2009-03-23 23:22 ` jakub at gcc dot gnu dot org
2010-03-22 16:12 ` dodji 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).