public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug debug/26754]  New: [4.0/4.1/4.2 Regression] Wrong debug info for variable accessed non-locally
@ 2006-03-19  9:54 ebotcazou at gcc dot gnu dot org
  2006-03-20  7:50 ` [Bug debug/26754] " pinskia at gcc dot gnu dot org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: ebotcazou at gcc dot gnu dot org @ 2006-03-19  9:54 UTC (permalink / raw)
  To: gcc-bugs

The subject says it all:

void foo(void)
{
  int a = 0;

  void bar(void)
  {
    a = 1;
  }

  bar ();
  a = a + 1;
}

int main(void)
{
  foo ();
}


GNU gdb 6.4
Copyright 2005 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i586-suse-linux"...Using host libthread_db library
"/lib/tls/libthread_db.so.1".

(gdb) b t.c:11
Breakpoint 1 at 0x8048389: file t.c, line 11.
(gdb) run
Starting program: /home/eric/gnat/bugs/F318-004/t

Breakpoint 1, foo () at t.c:11
11        a = a + 1;
(gdb) p a
$1 = -12412
(gdb) next
12      }
(gdb) p a
$2 = -12412


-- 
           Summary: [4.0/4.1/4.2 Regression] Wrong debug info for variable
                    accessed non-locally
           Product: gcc
           Version: 4.2.0
            Status: UNCONFIRMED
          Severity: major
          Priority: P3
         Component: debug
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: ebotcazou at gcc dot gnu dot org
 GCC build triplet: *-*-*
  GCC host triplet: *-*-*
GCC target triplet: *-*-*


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


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

* [Bug debug/26754] [4.0/4.1/4.2 Regression] Wrong debug info for variable accessed non-locally
  2006-03-19  9:54 [Bug debug/26754] New: [4.0/4.1/4.2 Regression] Wrong debug info for variable accessed non-locally ebotcazou at gcc dot gnu dot org
@ 2006-03-20  7:50 ` pinskia at gcc dot gnu dot org
  2006-03-20  7:54 ` pinskia at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-03-20  7:50 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pinskia at gcc dot gnu dot org  2006-03-20 07:50 -------
I could not get 3.3.3 (or 3.4.0 to get the correct results):
(gdb) b main
Breakpoint 1 at 0x8048374: file t.c, line 16.
(gdb) run
Starting program: /home/peshtigo/pinskia/a.out 

Breakpoint 1, main () at t.c:16
16        foo ();
(gdb) step
foo () at t.c:3
3         int a = 0;
(gdb) 
10        bar ();
(gdb) 
bar.0 () at t.c:7
7           a = 1;
(gdb) p a
No symbol "a" in current context.
(gdb) step
8         }
(gdb) p a
No symbol "a" in current context.
(gdb) step
foo () at t.c:11
11        a = a + 1;
(gdb) 
12      }
(gdb) 
main () at t.c:17
17      }
(gdb) 
0x003e7ad4 in __libc_start_main () from /lib/tls/libc.so.6


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|major                       |normal


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


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

* [Bug debug/26754] [4.0/4.1/4.2 Regression] Wrong debug info for variable accessed non-locally
  2006-03-19  9:54 [Bug debug/26754] New: [4.0/4.1/4.2 Regression] Wrong debug info for variable accessed non-locally ebotcazou at gcc dot gnu dot org
  2006-03-20  7:50 ` [Bug debug/26754] " pinskia at gcc dot gnu dot org
@ 2006-03-20  7:54 ` pinskia at gcc dot gnu dot org
  2006-05-13 18:55 ` ebotcazou at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-03-20  7:54 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from pinskia at gcc dot gnu dot org  2006-03-20 07:54 -------
Confirmed (I thought there was a way to get the variable in the nested function
from gdb but it looks like GCC/gdb does not do that but that is a different
issue).


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pinskia at gcc dot gnu dot
                   |                            |org
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
           Keywords|                            |wrong-debug
   Last reconfirmed|0000-00-00 00:00:00         |2006-03-20 07:54:11
               date|                            |
   Target Milestone|---                         |4.0.4


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


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

* [Bug debug/26754] [4.0/4.1/4.2 Regression] Wrong debug info for variable accessed non-locally
  2006-03-19  9:54 [Bug debug/26754] New: [4.0/4.1/4.2 Regression] Wrong debug info for variable accessed non-locally ebotcazou at gcc dot gnu dot org
  2006-03-20  7:50 ` [Bug debug/26754] " pinskia at gcc dot gnu dot org
  2006-03-20  7:54 ` pinskia at gcc dot gnu dot org
@ 2006-05-13 18:55 ` ebotcazou at gcc dot gnu dot org
  2006-05-14  3:02 ` patchapp at dberlin dot org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: ebotcazou at gcc dot gnu dot org @ 2006-05-13 18:55 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from ebotcazou at gcc dot gnu dot org  2006-05-13 18:55 -------
Patch in preparation.


-- 

ebotcazou at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |ebotcazou at gcc dot gnu dot
                   |dot org                     |org
             Status|NEW                         |ASSIGNED
   Last reconfirmed|2006-03-20 07:54:11         |2006-05-13 18:55:48
               date|                            |


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


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

* [Bug debug/26754] [4.0/4.1/4.2 Regression] Wrong debug info for variable accessed non-locally
  2006-03-19  9:54 [Bug debug/26754] New: [4.0/4.1/4.2 Regression] Wrong debug info for variable accessed non-locally ebotcazou at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2006-05-13 18:55 ` ebotcazou at gcc dot gnu dot org
@ 2006-05-14  3:02 ` patchapp at dberlin dot org
  2006-06-04 18:17 ` mmitchel at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: patchapp at dberlin dot org @ 2006-05-14  3:02 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from patchapp at dberlin dot org  2006-05-14 03:02 -------
Subject: Bug number PR debug/26754

A patch for this bug has been added to the patch tracker.
The mailing list url for the patch is
http://gcc.gnu.org/ml/gcc-patches/2006-05/msg00581.html


-- 


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


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

* [Bug debug/26754] [4.0/4.1/4.2 Regression] Wrong debug info for variable accessed non-locally
  2006-03-19  9:54 [Bug debug/26754] New: [4.0/4.1/4.2 Regression] Wrong debug info for variable accessed non-locally ebotcazou at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2006-05-14  3:02 ` patchapp at dberlin dot org
@ 2006-06-04 18:17 ` mmitchel at gcc dot gnu dot org
  2006-06-07  6:38 ` ebotcazou at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2006-06-04 18:17 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from mmitchel at gcc dot gnu dot org  2006-06-04 18:16 -------
The idea of this patch seems OK, but let's find a way to avoid duplicating the
declare_tmp_vars code, perhaps by making another small routine to find the
outermost BIND_EXPR in a function?


-- 

mmitchel at gcc dot gnu dot org changed:

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


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


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

* [Bug debug/26754] [4.0/4.1/4.2 Regression] Wrong debug info for variable accessed non-locally
  2006-03-19  9:54 [Bug debug/26754] New: [4.0/4.1/4.2 Regression] Wrong debug info for variable accessed non-locally ebotcazou at gcc dot gnu dot org
                   ` (4 preceding siblings ...)
  2006-06-04 18:17 ` mmitchel at gcc dot gnu dot org
@ 2006-06-07  6:38 ` ebotcazou at gcc dot gnu dot org
  2006-06-13  8:57 ` ebotcazou at gcc dot gnu dot org
  2006-06-13  9:01 ` [Bug debug/26754] [4.0/4.1 " ebotcazou at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: ebotcazou at gcc dot gnu dot org @ 2006-06-07  6:38 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from ebotcazou at gcc dot gnu dot org  2006-06-07 06:19 -------
> The idea of this patch seems OK, but let's find a way to avoid duplicating the
> declare_tmp_vars code, perhaps by making another small routine to find the
> outermost BIND_EXPR in a function?

Do you really want to make a new function for this loop only?

      /* C99 mode puts the default 'return 0;' for main outside the outer
        braces.  So drill down until we find an actual scope.  */
      while (TREE_CODE (scope) == COMPOUND_EXPR)
       scope = TREE_OPERAND (scope, 0);


-- 


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


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

* [Bug debug/26754] [4.0/4.1/4.2 Regression] Wrong debug info for variable accessed non-locally
  2006-03-19  9:54 [Bug debug/26754] New: [4.0/4.1/4.2 Regression] Wrong debug info for variable accessed non-locally ebotcazou at gcc dot gnu dot org
                   ` (5 preceding siblings ...)
  2006-06-07  6:38 ` ebotcazou at gcc dot gnu dot org
@ 2006-06-13  8:57 ` ebotcazou at gcc dot gnu dot org
  2006-06-13  9:01 ` [Bug debug/26754] [4.0/4.1 " ebotcazou at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: ebotcazou at gcc dot gnu dot org @ 2006-06-13  8:57 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from ebotcazou at gcc dot gnu dot org  2006-06-13 08:55 -------
Subject: Bug 26754

Author: ebotcazou
Date: Tue Jun 13 08:55:40 2006
New Revision: 114605

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=114605
Log:
        PR debug/26754
        * gimplify.c (declare_tmp_vars): Rename into declare_vars.
        Add debug_info parameter.  Chain the vars to the BLOCK instead
        of the BIND_EXPR if debug info are requested for them.
        (pop_gimplify_context): Adjust for above change.
        (gimple_add_tmp_var): Likewise.
        * tree-gimple.h (declare_tmp_vars): Rename into declare_vars.
        Add bool parameter.
        * tree-nested.c (convert_nonlocal_reference): Adjust for above change.
        (convert_local_reference): Likewise.
        (get_local_debug_decl): Set DECL_IGNORED_P on the original variable.
        (finalize_nesting_tree_1): Request that debug info be emitted
        for debug_var_chain.


Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/gimplify.c
    trunk/gcc/tree-gimple.h
    trunk/gcc/tree-nested.c


-- 


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


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

* [Bug debug/26754] [4.0/4.1 Regression] Wrong debug info for variable accessed non-locally
  2006-03-19  9:54 [Bug debug/26754] New: [4.0/4.1/4.2 Regression] Wrong debug info for variable accessed non-locally ebotcazou at gcc dot gnu dot org
                   ` (6 preceding siblings ...)
  2006-06-13  8:57 ` ebotcazou at gcc dot gnu dot org
@ 2006-06-13  9:01 ` ebotcazou at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: ebotcazou at gcc dot gnu dot org @ 2006-06-13  9:01 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from ebotcazou at gcc dot gnu dot org  2006-06-13 08:56 -------
Fixed on mainline.


-- 

ebotcazou at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED
            Summary|[4.0/4.1/4.2 Regression]    |[4.0/4.1 Regression] Wrong
                   |Wrong debug info for        |debug info for variable
                   |variable accessed non-      |accessed non-locally
                   |locally                     |
   Target Milestone|4.0.4                       |4.2.0


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


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

end of thread, other threads:[~2006-06-13  8:57 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-03-19  9:54 [Bug debug/26754] New: [4.0/4.1/4.2 Regression] Wrong debug info for variable accessed non-locally ebotcazou at gcc dot gnu dot org
2006-03-20  7:50 ` [Bug debug/26754] " pinskia at gcc dot gnu dot org
2006-03-20  7:54 ` pinskia at gcc dot gnu dot org
2006-05-13 18:55 ` ebotcazou at gcc dot gnu dot org
2006-05-14  3:02 ` patchapp at dberlin dot org
2006-06-04 18:17 ` mmitchel at gcc dot gnu dot org
2006-06-07  6:38 ` ebotcazou at gcc dot gnu dot org
2006-06-13  8:57 ` ebotcazou at gcc dot gnu dot org
2006-06-13  9:01 ` [Bug debug/26754] [4.0/4.1 " ebotcazou 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).