public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug debug/21828] New: [4.1 Regression] stabs debug info completely broken?
@ 2005-05-30 18:49 bonzini at gcc dot gnu dot org
  2005-05-31  5:38 ` [Bug debug/21828] " dje at gcc dot gnu dot org
                   ` (33 more replies)
  0 siblings, 34 replies; 35+ messages in thread
From: bonzini at gcc dot gnu dot org @ 2005-05-30 18:49 UTC (permalink / raw)
  To: gcc-bugs

When using gdb-309 and gdb-370 on MacOS X 10.3.9, even the simplest queries seem
broken.

On stage2 gengtype, I get

scientist:~/cvs/gcc/build/gcc bonzinip$ gdb build/gengtype
(gdb) b mangle_macro_name 
Breakpoint 5 at 0x8458: file ../../gcc/gengtype-lex.l, line 429.
(gdb) run
Breakpoint 5, mangle_macro_name ([snip]) at ../../gcc/gengtype-lex.l:429
(gdb) fini
Run till exit from #0 mangle_macro_name ([snip]) at ../../gcc/gengtype-lex.l:429
yylex () at ../../gcc/gengtype-lex.l:263
263       t = find_structure (ptr, 0);
Value returned is $1 = 0x11ccb0 "VEC_tree"
(gdb) p ptr
No symbol "ptr" in current context.

...
228       for (s = structures; s != NULL; s = s->next)
(gdb) p structures
$2 = <unknown type>

...
106       for (p = typedefs; p != NULL; p = p->next)
(gdb) p typedefs
$5 = <unknown type>

and so on.

Paolo

-- 
           Summary: [4.1 Regression] stabs debug info completely broken?
           Product: gcc
           Version: 4.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: debug
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: bonzini at gcc dot gnu dot org
                CC: gcc-bugs at gcc dot gnu dot org
GCC target triplet: powerpc-apple-darwin7.9.0


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


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

* [Bug debug/21828] [4.1 Regression] stabs debug info completely broken?
  2005-05-30 18:49 [Bug debug/21828] New: [4.1 Regression] stabs debug info completely broken? bonzini at gcc dot gnu dot org
@ 2005-05-31  5:38 ` dje at gcc dot gnu dot org
  2005-05-31 13:15 ` [Bug debug/21828] [4.0/4.1 Regression] debug info omitted for global variables bonzini at gcc dot gnu dot org
                   ` (32 subsequent siblings)
  33 siblings, 0 replies; 35+ messages in thread
From: dje at gcc dot gnu dot org @ 2005-05-31  5:38 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From dje at gcc dot gnu dot org  2005-05-31 04:39 -------
I see similar problems on AIX.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
   Last reconfirmed|0000-00-00 00:00:00         |2005-05-31 04:39:15
               date|                            |


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


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

* [Bug debug/21828] [4.0/4.1 Regression] debug info omitted for global variables
  2005-05-30 18:49 [Bug debug/21828] New: [4.1 Regression] stabs debug info completely broken? bonzini at gcc dot gnu dot org
  2005-05-31  5:38 ` [Bug debug/21828] " dje at gcc dot gnu dot org
@ 2005-05-31 13:15 ` bonzini at gcc dot gnu dot org
  2005-06-05 23:48 ` mmitchel at gcc dot gnu dot org
                   ` (31 subsequent siblings)
  33 siblings, 0 replies; 35+ messages in thread
From: bonzini at gcc dot gnu dot org @ 2005-05-31 13:15 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From bonzini at gcc dot gnu dot org  2005-05-31 13:11 -------
Ulrich Weigand wrote:

When building with -funit-at-a-time (which is on by default with -O2), *no*
debug info for global variables appears to be emitted at all.

The problem appears to be this piece of code in check_global_declarations:

      /* Do not emit debug information about variables that are in
         static storage, but not defined.  */
      if (TREE_CODE (decl) == VAR_DECL
          && TREE_STATIC (decl)
          && !TREE_ASM_WRITTEN (decl))
        DECL_IGNORED_P (decl) = 1;

which was added by:
http://gcc.gnu.org/ml/gcc-cvs/2004-11/msg01250.html

2004-11-25  Mark Mitchell  <mark@codesourcery.com>

        PR c++/18556
        * toplev.c (check_global_declarations): Set DECL_IGNORED_P on
        unemitted variables with static storage duration.


However, check_global_declarations is called (by the C front-end at least)
*before* the call to cgraph_optimize.  At this time, when -funit-at-a-time
is in effect, *no* variables have been emitted to assembler as far as I
can tell, and thus all global variables get the DECL_IGNORED_P flag.

Interestingly enough, when building with the C++ front-end, the debug
info is properly emitted.  I'm not sure where exactly the difference is ...

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |uweigand at de dot ibm dot
                   |                            |com, mark at codesourcery
                   |                            |dot com
           Severity|normal                      |critical
 GCC target triplet|powerpc-apple-darwin7.9.0   |
           Priority|P2                          |P1
            Summary|[4.1 Regression] stabs debug|[4.0/4.1 Regression] debug
                   |info completely broken?     |info omitted for global
                   |                            |variables
   Target Milestone|---                         |4.0.1
            Version|4.1.0                       |4.0.0


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


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

* [Bug debug/21828] [4.0/4.1 Regression] debug info omitted for global variables
  2005-05-30 18:49 [Bug debug/21828] New: [4.1 Regression] stabs debug info completely broken? bonzini at gcc dot gnu dot org
  2005-05-31  5:38 ` [Bug debug/21828] " dje at gcc dot gnu dot org
  2005-05-31 13:15 ` [Bug debug/21828] [4.0/4.1 Regression] debug info omitted for global variables bonzini at gcc dot gnu dot org
@ 2005-06-05 23:48 ` mmitchel at gcc dot gnu dot org
  2005-06-05 23:50 ` pinskia at gcc dot gnu dot org
                   ` (30 subsequent siblings)
  33 siblings, 0 replies; 35+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2005-06-05 23:48 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From mmitchel at gcc dot gnu dot org  2005-06-05 23:48 -------
Is there a test case for this bug?  (The usual things: preprocessed source,
command-line, etc.?)

-- 


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


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

* [Bug debug/21828] [4.0/4.1 Regression] debug info omitted for global variables
  2005-05-30 18:49 [Bug debug/21828] New: [4.1 Regression] stabs debug info completely broken? bonzini at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2005-06-05 23:48 ` mmitchel at gcc dot gnu dot org
@ 2005-06-05 23:50 ` pinskia at gcc dot gnu dot org
  2005-06-06  0:16 ` mark at codesourcery dot com
                   ` (29 subsequent siblings)
  33 siblings, 0 replies; 35+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-06-05 23:50 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-06-05 23:50 -------
(In reply to comment #3)
> Is there a test case for this bug?  (The usual things: preprocessed source,
> command-line, etc.?)
>From <http://gcc.gnu.org/ml/gcc/2005-05/msg01635.html>:

You can reproduce it using:
static int i;
int main(void)
{
  i += 3;
  i *= 5;
  return 0;
}

and readelf and looking for the DW_TAG_variable tag.


-- 


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


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

* [Bug debug/21828] [4.0/4.1 Regression] debug info omitted for global variables
  2005-05-30 18:49 [Bug debug/21828] New: [4.1 Regression] stabs debug info completely broken? bonzini at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2005-06-05 23:50 ` pinskia at gcc dot gnu dot org
@ 2005-06-06  0:16 ` mark at codesourcery dot com
  2005-06-06  0:21 ` mmitchel at gcc dot gnu dot org
                   ` (28 subsequent siblings)
  33 siblings, 0 replies; 35+ messages in thread
From: mark at codesourcery dot com @ 2005-06-06  0:16 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From mark at codesourcery dot com  2005-06-06 00:15 -------
Subject: Re:  [4.0/4.1 Regression] debug info omitted for
 global variables

pinskia at gcc dot gnu dot org wrote:
> ------- Additional Comments From pinskia at gcc dot gnu dot org  2005-06-05 23:50 -------
> (In reply to comment #3)
> 
>>Is there a test case for this bug?  (The usual things: preprocessed source,
>>command-line, etc.?)
> 
> From <http://gcc.gnu.org/ml/gcc/2005-05/msg01635.html>:
> 
> You can reproduce it using:
> static int i;
> int main(void)
> {
>   i += 3;
>   i *= 5;
>   return 0;
> }
> 
> and readelf and looking for the DW_TAG_variable tag.

Thanks.  I can see the problem, when compiling with -O2.

I'm not really sure yet whether this is my fault, or whether some 
subsequent change to cgraph after my changes got checked in broke things.

In any case, I'm don't think that the code I wrote in 
check_global_declarations is wrong, in and of itself.  If 
check_global_declarations is going to be responsible for calling 
debug_hooks->global_decl, then we must set DECL_IGNORED_P correctly by 
that point.  (That assume that, in fact, we should not put out debugging 
information about variables that have been optimized away; I think that 
assumption is correct in that we might otherwise get relocations against 
them, at least in some debugging formats.)

But, the way things are set up, we apparently don't really know whether 
or not we're going to output the variables until cgraph_optimize, which 
is not called until later in c_write_global_declarations.

That suggests that perhaps the correct fix is to move the call to 
debug_hooks->global_decl into cgraph, or have it in both places.  Or, 
perhaps cgraph_optimize should be called before check_global_declarations.



-- 


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


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

* [Bug debug/21828] [4.0/4.1 Regression] debug info omitted for global variables
  2005-05-30 18:49 [Bug debug/21828] New: [4.1 Regression] stabs debug info completely broken? bonzini at gcc dot gnu dot org
                   ` (4 preceding siblings ...)
  2005-06-06  0:16 ` mark at codesourcery dot com
@ 2005-06-06  0:21 ` mmitchel at gcc dot gnu dot org
  2005-06-06  0:47 ` mmitchel at gcc dot gnu dot org
                   ` (27 subsequent siblings)
  33 siblings, 0 replies; 35+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2005-06-06  0:21 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From mmitchel at gcc dot gnu dot org  2005-06-06 00:21 -------
In fact, the C++ front end calls cgraph_optimize before
check_global_declarations, so it's at least possible to make the calls in that
order.  It's possible that we miss some warnings or something that way, if
cgraph_optimize destroys information that we need -- but it's apparently not a
total disaster.

-- 


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


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

* [Bug debug/21828] [4.0/4.1 Regression] debug info omitted for global variables
  2005-05-30 18:49 [Bug debug/21828] New: [4.1 Regression] stabs debug info completely broken? bonzini at gcc dot gnu dot org
                   ` (5 preceding siblings ...)
  2005-06-06  0:21 ` mmitchel at gcc dot gnu dot org
@ 2005-06-06  0:47 ` mmitchel at gcc dot gnu dot org
  2005-07-04 17:54 ` pinskia at gcc dot gnu dot org
                   ` (26 subsequent siblings)
  33 siblings, 0 replies; 35+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2005-06-06  0:47 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From mmitchel at gcc dot gnu dot org  2005-06-06 00:47 -------
Indeed, this patch seems to fix the problem.  (Untested as of yet, beyond
running the debug.exp tests and the original testcase.)

Joseph, Richard, any thoughts on the appropriateness of this for the C front end?

Index: c-decl.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c-decl.c,v
retrieving revision 1.660
diff -c -5 -p -r1.660 c-decl.c
*** c-decl.c    28 May 2005 01:38:08 -0000      1.660
--- c-decl.c    6 Jun 2005 00:46:03 -0000
*************** c_write_global_declarations (void)
*** 7548,7570 ****
    /* Close the external scope.  */
    ext_block = pop_scope ();
    external_scope = 0;
    gcc_assert (!current_scope);

-   /* Process all file scopes in this compilation, and the external_scope,
-      through wrapup_global_declarations and check_global_declarations.  */
-   for (t = all_translation_units; t; t = TREE_CHAIN (t))
-     c_write_global_declarations_1 (BLOCK_VARS (DECL_INITIAL (t)));
-   c_write_global_declarations_1 (BLOCK_VARS (ext_block));
-
    /* Generate functions to call static constructors and destructors
       for targets that do not support .ctors/.dtors sections.  These
       functions have magic names which are detected by collect2.  */
    build_cdtor ('I', static_ctors); static_ctors = 0;
    build_cdtor ('D', static_dtors); static_dtors = 0;

    /* We're done parsing; proceed to optimize and emit assembly.
       FIXME: shouldn't be the front end's responsibility to call this.  */
    cgraph_optimize ();
  }

  #include "gt-c-decl.h"
--- 7548,7570 ----
    /* Close the external scope.  */
    ext_block = pop_scope ();
    external_scope = 0;
    gcc_assert (!current_scope);

    /* Generate functions to call static constructors and destructors
       for targets that do not support .ctors/.dtors sections.  These
       functions have magic names which are detected by collect2.  */
    build_cdtor ('I', static_ctors); static_ctors = 0;
    build_cdtor ('D', static_dtors); static_dtors = 0;

    /* We're done parsing; proceed to optimize and emit assembly.
       FIXME: shouldn't be the front end's responsibility to call this.  */
    cgraph_optimize ();
+
+   /* Process all file scopes in this compilation, and the external_scope,
+      through wrapup_global_declarations and check_global_declarations.  */
+   for (t = all_translation_units; t; t = TREE_CHAIN (t))
+     c_write_global_declarations_1 (BLOCK_VARS (DECL_INITIAL (t)));
+   c_write_global_declarations_1 (BLOCK_VARS (ext_block));
  }

  #include "gt-c-decl.h"


-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |rth at gcc dot gnu dot org,
                   |                            |joseph at codesourcery dot
                   |                            |com


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


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

* [Bug debug/21828] [4.0/4.1 Regression] debug info omitted for global variables
  2005-05-30 18:49 [Bug debug/21828] New: [4.1 Regression] stabs debug info completely broken? bonzini at gcc dot gnu dot org
                   ` (6 preceding siblings ...)
  2005-06-06  0:47 ` mmitchel at gcc dot gnu dot org
@ 2005-07-04 17:54 ` pinskia at gcc dot gnu dot org
  2005-07-04 17:59 ` hjl at lucon dot org
                   ` (25 subsequent siblings)
  33 siblings, 0 replies; 35+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-07-04 17:54 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-07-04 17:54 -------
*** Bug 22295 has been marked as a duplicate of this bug. ***

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |hjl at lucon dot org


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


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

* [Bug debug/21828] [4.0/4.1 Regression] debug info omitted for global variables
  2005-05-30 18:49 [Bug debug/21828] New: [4.1 Regression] stabs debug info completely broken? bonzini at gcc dot gnu dot org
                   ` (7 preceding siblings ...)
  2005-07-04 17:54 ` pinskia at gcc dot gnu dot org
@ 2005-07-04 17:59 ` hjl at lucon dot org
  2005-07-04 18:21 ` hjl at lucon dot org
                   ` (24 subsequent siblings)
  33 siblings, 0 replies; 35+ messages in thread
From: hjl at lucon dot org @ 2005-07-04 17:59 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From hjl at lucon dot org  2005-07-04 17:59 -------
Gcc Red Hat 4.0.0-8 seems OK. Does Red Hat have a fix on gcc-4_0-rhl-branch?
This bug makes it very hard to debug binaries generated by gcc 4.0.

-- 


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


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

* [Bug debug/21828] [4.0/4.1 Regression] debug info omitted for global variables
  2005-05-30 18:49 [Bug debug/21828] New: [4.1 Regression] stabs debug info completely broken? bonzini at gcc dot gnu dot org
                   ` (8 preceding siblings ...)
  2005-07-04 17:59 ` hjl at lucon dot org
@ 2005-07-04 18:21 ` hjl at lucon dot org
  2005-07-04 20:06 ` [Bug debug/21828] [4.0/4.1 Regression] debug info omitted for uninitialized variables hjl at lucon dot org
                   ` (23 subsequent siblings)
  33 siblings, 0 replies; 35+ messages in thread
From: hjl at lucon dot org @ 2005-07-04 18:21 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From hjl at lucon dot org  2005-07-04 18:21 -------
I checked the current gcc-4_0-rhl-branch in CVS. It has the same problem.
Can we revisit bug 18556? I can test both.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
  BugsThisDependsOn|                            |18556


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


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

* [Bug debug/21828] [4.0/4.1 Regression] debug info omitted for uninitialized variables
  2005-05-30 18:49 [Bug debug/21828] New: [4.1 Regression] stabs debug info completely broken? bonzini at gcc dot gnu dot org
                   ` (9 preceding siblings ...)
  2005-07-04 18:21 ` hjl at lucon dot org
@ 2005-07-04 20:06 ` hjl at lucon dot org
  2005-07-05  6:09 ` hjl at lucon dot org
                   ` (22 subsequent siblings)
  33 siblings, 0 replies; 35+ messages in thread
From: hjl at lucon dot org @ 2005-07-04 20:06 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From hjl at lucon dot org  2005-07-04 20:06 -------
My patch doesn't handle uninitiliazed local variables correctly. The difference
between C and C++ is C++ writes out variables first.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[4.0/4.1 Regression] debug  |[4.0/4.1 Regression] debug
                   |info omitted for global     |info omitted for
                   |variables                   |uninitialized variables


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


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

* [Bug debug/21828] [4.0/4.1 Regression] debug info omitted for uninitialized variables
  2005-05-30 18:49 [Bug debug/21828] New: [4.1 Regression] stabs debug info completely broken? bonzini at gcc dot gnu dot org
                   ` (10 preceding siblings ...)
  2005-07-04 20:06 ` [Bug debug/21828] [4.0/4.1 Regression] debug info omitted for uninitialized variables hjl at lucon dot org
@ 2005-07-05  6:09 ` hjl at lucon dot org
  2005-07-05 16:56 ` hjl at lucon dot org
                   ` (21 subsequent siblings)
  33 siblings, 0 replies; 35+ messages in thread
From: hjl at lucon dot org @ 2005-07-05  6:09 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From hjl at lucon dot org  2005-07-05 06:09 -------
My patch doesn't work with gcc.dg/varpool-1.c. c_write_global_declarations
seems calling check_global_declarations and cgraph_optimize in the wrong
order. Shouldn't check_global_declarations be called after cgraph_optimize
instead of before?

-- 


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


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

* [Bug debug/21828] [4.0/4.1 Regression] debug info omitted for uninitialized variables
  2005-05-30 18:49 [Bug debug/21828] New: [4.1 Regression] stabs debug info completely broken? bonzini at gcc dot gnu dot org
                   ` (11 preceding siblings ...)
  2005-07-05  6:09 ` hjl at lucon dot org
@ 2005-07-05 16:56 ` hjl at lucon dot org
  2005-07-08  0:46 ` wilson at specifix dot com
                   ` (20 subsequent siblings)
  33 siblings, 0 replies; 35+ messages in thread
From: hjl at lucon dot org @ 2005-07-05 16:56 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From hjl at lucon dot org  2005-07-05 16:56 -------
Patches for mainline and 4.0 are posted at

http://gcc.gnu.org/ml/gcc-patches/2005-07/msg00270.html

I hope they lead to the proper fixes and this critical regression
is fixed in 4.0.1.

-- 


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


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

* [Bug debug/21828] [4.0/4.1 Regression] debug info omitted for uninitialized variables
  2005-05-30 18:49 [Bug debug/21828] New: [4.1 Regression] stabs debug info completely broken? bonzini at gcc dot gnu dot org
                   ` (12 preceding siblings ...)
  2005-07-05 16:56 ` hjl at lucon dot org
@ 2005-07-08  0:46 ` wilson at specifix dot com
  2005-07-08  1:44 ` mmitchel at gcc dot gnu dot org
                   ` (19 subsequent siblings)
  33 siblings, 0 replies; 35+ messages in thread
From: wilson at specifix dot com @ 2005-07-08  0:46 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From wilson at specifix dot com  2005-07-08 00:46 -------
Subject: Re:  [4.0/4.1 Regression] debug info omitted for
 uninitialized variables

hjl at lucon dot org wrote:
> ------- Additional Comments From hjl at lucon dot org  2005-07-05 16:56 -------
> Patches for mainline and 4.0 are posted at
> http://gcc.gnu.org/ml/gcc-patches/2005-07/msg00270.html
> I hope they lead to the proper fixes and this critical regression
> is fixed in 4.0.1.

I think you are just compounding the mistake created by Mark Mitchell's 
patch for PR 18556.  I mentioned this in comment #8, which unfortunately 
didn't get sent to the gcc-bugs mailing list.


-- 


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


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

* [Bug debug/21828] [4.0/4.1 Regression] debug info omitted for uninitialized variables
  2005-05-30 18:49 [Bug debug/21828] New: [4.1 Regression] stabs debug info completely broken? bonzini at gcc dot gnu dot org
                   ` (13 preceding siblings ...)
  2005-07-08  0:46 ` wilson at specifix dot com
@ 2005-07-08  1:44 ` mmitchel at gcc dot gnu dot org
  2005-07-08  2:01 ` mark at codesourcery dot com
                   ` (18 subsequent siblings)
  33 siblings, 0 replies; 35+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2005-07-08  1:44 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|4.0.1                       |4.0.2


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


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

* [Bug debug/21828] [4.0/4.1 Regression] debug info omitted for uninitialized variables
  2005-05-30 18:49 [Bug debug/21828] New: [4.1 Regression] stabs debug info completely broken? bonzini at gcc dot gnu dot org
                   ` (14 preceding siblings ...)
  2005-07-08  1:44 ` mmitchel at gcc dot gnu dot org
@ 2005-07-08  2:01 ` mark at codesourcery dot com
  2005-07-19 23:36 ` dpatel at apple dot com
                   ` (17 subsequent siblings)
  33 siblings, 0 replies; 35+ messages in thread
From: mark at codesourcery dot com @ 2005-07-08  2:01 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From mark at codesourcery dot com  2005-07-08 01:56 -------
Subject: Re:  [4.0/4.1 Regression] debug info omitted for
 uninitialized variables

wilson at specifix dot com wrote:

> I think you are just compounding the mistake created by Mark Mitchell's 
> patch for PR 18556.  I mentioned this in comment #8, which unfortunately 
> didn't get sent to the gcc-bugs mailing list.

I agree that, in the abstract, the debug information should match the 
source program.  However, the problem was that we generated debug 
information that referenced a non-existant symbol, which is clearly a 
major problem.  I'm not sure why the debug generator did that; perhaps 
that's the real bug, as you suggest.

My change essentially restored the behavior of check_global_declarations 
to its historical state; clearing DECL_RTL (as this code used to do) was 
essentially supposed to turn off generation of debugging information for 
the variable.  If information was still emitted, that was somewhat by 
accident, judging by the comment there.

Since this bug does not affect the C++ front end, it's clear that it's 
possible to write a front end in which things work as expected.

So, there would be seem to be two ways to potential ways to fix things: 
(1) change the debug generators, as you suggest; (2) change the C front end.

I'd be happy to help with either approach; this is certainly my fault, 
independently of where the fix lies.  However, as you've volunteered to 
look at the debug generators, I'm going to leave this bug aside until 
you report back.  If you don't have time to look soon, would you please 
let me know?

Thanks,



-- 


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


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

* [Bug debug/21828] [4.0/4.1 Regression] debug info omitted for uninitialized variables
  2005-05-30 18:49 [Bug debug/21828] New: [4.1 Regression] stabs debug info completely broken? bonzini at gcc dot gnu dot org
                   ` (15 preceding siblings ...)
  2005-07-08  2:01 ` mark at codesourcery dot com
@ 2005-07-19 23:36 ` dpatel at apple dot com
  2005-07-20 12:31 ` jakub at redhat dot com
                   ` (16 subsequent siblings)
  33 siblings, 0 replies; 35+ messages in thread
From: dpatel at apple dot com @ 2005-07-19 23:36 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From dpatel at apple dot com  2005-07-19 22:22 -------
No activity in last few days. Mark, would it be possible for you to take a look at this again! Thank you.

-- 


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


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

* [Bug debug/21828] [4.0/4.1 Regression] debug info omitted for uninitialized variables
  2005-05-30 18:49 [Bug debug/21828] New: [4.1 Regression] stabs debug info completely broken? bonzini at gcc dot gnu dot org
                   ` (16 preceding siblings ...)
  2005-07-19 23:36 ` dpatel at apple dot com
@ 2005-07-20 12:31 ` jakub at redhat dot com
  2005-07-20 14:47 ` mark at codesourcery dot com
                   ` (15 subsequent siblings)
  33 siblings, 0 replies; 35+ messages in thread
From: jakub at redhat dot com @ 2005-07-20 12:31 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From jakub at redhat dot com  2005-07-20 11:41 -------
I have done a binary search and at least for the failures and at least those
problems mentioned in PR c++/18556 are fixed by PR middle-end/17799 without
the need for PR c++/18556 patch.
Now, the question is I think if there is a testcase that still needs
PR c++/18556 patch.  If not, at least for gcc-4_0-branch IMHO the easiest
would be simply to revert that patch.  If yes, but it is C++ only and there
can't be a case when something like that is needed in C, a quick fix would be
      /* Do not emit debug information about variables that are in
         static storage, but not defined.  */
      if (TREE_CODE (decl) == VAR_DECL
+         && (cgraph_global_info_ready || !flag_unit_at_a_time)
          && TREE_STATIC (decl)
          && !TREE_ASM_WRITTEN (decl))
        DECL_IGNORED_P (decl) = 1;
so we would not force no debugging for a var decl that has not been written,
unless cgraph_optimize has been called already or -fno-unit-at-a-time.

-- 


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


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

* [Bug debug/21828] [4.0/4.1 Regression] debug info omitted for uninitialized variables
  2005-05-30 18:49 [Bug debug/21828] New: [4.1 Regression] stabs debug info completely broken? bonzini at gcc dot gnu dot org
                   ` (17 preceding siblings ...)
  2005-07-20 12:31 ` jakub at redhat dot com
@ 2005-07-20 14:47 ` mark at codesourcery dot com
  2005-07-21 23:26 ` mmitchel at gcc dot gnu dot org
                   ` (14 subsequent siblings)
  33 siblings, 0 replies; 35+ messages in thread
From: mark at codesourcery dot com @ 2005-07-20 14:47 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From mark at codesourcery dot com  2005-07-20 14:40 -------
Subject: Re:  [4.0/4.1 Regression] debug info omitted for
 uninitialized variables

jakub at redhat dot com wrote:
> ------- Additional Comments From jakub at redhat dot com  2005-07-20 11:41 -------
> I have done a binary search and at least for the failures and at least those
> problems mentioned in PR c++/18556 are fixed by PR middle-end/17799 without
> the need for PR c++/18556 patch.
> Now, the question is I think if there is a testcase that still needs
> PR c++/18556 patch.  If not, at least for gcc-4_0-branch IMHO the easiest
> would be simply to revert that patch.  If yes, but it is C++ only and there
> can't be a case when something like that is needed in C, a quick fix would be
>       /* Do not emit debug information about variables that are in
>          static storage, but not defined.  */
>       if (TREE_CODE (decl) == VAR_DECL
> +         && (cgraph_global_info_ready || !flag_unit_at_a_time)
>           && TREE_STATIC (decl)
>           && !TREE_ASM_WRITTEN (decl))
>         DECL_IGNORED_P (decl) = 1;
> so we would not force no debugging for a var decl that has not been written,
> unless cgraph_optimize has been called already or -fno-unit-at-a-time.

I will look at this in more detail today.  Thanks!



-- 


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


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

* [Bug debug/21828] [4.0/4.1 Regression] debug info omitted for uninitialized variables
  2005-05-30 18:49 [Bug debug/21828] New: [4.1 Regression] stabs debug info completely broken? bonzini at gcc dot gnu dot org
                   ` (18 preceding siblings ...)
  2005-07-20 14:47 ` mark at codesourcery dot com
@ 2005-07-21 23:26 ` mmitchel at gcc dot gnu dot org
  2005-07-22  6:52 ` mark at codesourcery dot com
                   ` (13 subsequent siblings)
  33 siblings, 0 replies; 35+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2005-07-21 23:26 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From mmitchel at gcc dot gnu dot org  2005-07-21 23:26 -------
Jakub --

Thank you for finding the patch that fixed this problem.  

Richard's patch changed things to mark the problematic variable as
DECL_IGNORED_P earlier, so my patch is no longer necessary.

As for Jim's comments about matching the source, the variable is also
DECL_ARTIFICIAL, so perhaps its reasonable to assume that the user doesn't care
about it.

I will try a test run with my patch reverted; if that passes, and still fixes
the bug in this PR, I will check in.

Thanks!

-- Mark

-- 


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


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

* [Bug debug/21828] [4.0/4.1 Regression] debug info omitted for uninitialized variables
  2005-05-30 18:49 [Bug debug/21828] New: [4.1 Regression] stabs debug info completely broken? bonzini at gcc dot gnu dot org
                   ` (19 preceding siblings ...)
  2005-07-21 23:26 ` mmitchel at gcc dot gnu dot org
@ 2005-07-22  6:52 ` mark at codesourcery dot com
  2005-07-22  7:14 ` mark at codesourcery dot com
                   ` (12 subsequent siblings)
  33 siblings, 0 replies; 35+ messages in thread
From: mark at codesourcery dot com @ 2005-07-22  6:52 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From mark at codesourcery dot com  2005-07-22 06:25 -------
Subject: Re:  [4.0/4.1 Regression] debug info omitted for
 uninitialized variables

mmitchel at gcc dot gnu dot org wrote:

> I will try a test run with my patch reverted; if that passes, and still fixes
> the bug in this PR, I will check in.

Unfortunately, it failed -- gcc.dg/pch/global-1.c fails at -O3.

I have not yet figured out why...



-- 


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


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

* [Bug debug/21828] [4.0/4.1 Regression] debug info omitted for uninitialized variables
  2005-05-30 18:49 [Bug debug/21828] New: [4.1 Regression] stabs debug info completely broken? bonzini at gcc dot gnu dot org
                   ` (20 preceding siblings ...)
  2005-07-22  6:52 ` mark at codesourcery dot com
@ 2005-07-22  7:14 ` mark at codesourcery dot com
  2005-07-22 17:43 ` cvs-commit at gcc dot gnu dot org
                   ` (11 subsequent siblings)
  33 siblings, 0 replies; 35+ messages in thread
From: mark at codesourcery dot com @ 2005-07-22  7:14 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From mark at codesourcery dot com  2005-07-22 06:52 -------
Subject: Re:  [4.0/4.1 Regression] debug info omitted for
 uninitialized variables

mark at codesourcery dot com wrote:

> Unfortunately, it failed -- gcc.dg/pch/global-1.c fails at -O3.
> 
> I have not yet figured out why...

This has to do with the fact that first_global_object_name and 
weak_global_object_name are not preserved across PCH; this looks to be a 
bug latent since the introduction of PCH.  Working on fixing that now...



-- 


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


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

* [Bug debug/21828] [4.0/4.1 Regression] debug info omitted for uninitialized variables
  2005-05-30 18:49 [Bug debug/21828] New: [4.1 Regression] stabs debug info completely broken? bonzini at gcc dot gnu dot org
                   ` (21 preceding siblings ...)
  2005-07-22  7:14 ` mark at codesourcery dot com
@ 2005-07-22 17:43 ` cvs-commit at gcc dot gnu dot org
  2005-07-22 17:46 ` [Bug debug/21828] [4.0 " mmitchel at gcc dot gnu dot org
                   ` (10 subsequent siblings)
  33 siblings, 0 replies; 35+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2005-07-22 17:43 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2005-07-22 17:40 -------
Subject: Bug 21828

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	mmitchel@gcc.gnu.org	2005-07-22 17:40:37

Modified files:
	gcc            : ChangeLog toplev.c varasm.c 
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/gcc.dg/debug/dwarf2: dwarf-uninit.c 

Log message:
	PR debug/21828
	* toplev.c (check_global_declarations): Do not mark undefined
	variables as DECL_IGNORED_P.
	* varasm.c (first_global_object_name): GTY it.
	(weak_global_object_name): Likewise.
	(notice_global_symbol): Use ggc_strdup, not xstrdup, when creating
	a string to go into {weak,first}_global_object_name.
	
	PR debug/21828
	* gcc.dg/debug/dwarf2/dwarf-uninit.c: New test.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.9521&r2=2.9522
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/toplev.c.diff?cvsroot=gcc&r1=1.972&r2=1.973
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/varasm.c.diff?cvsroot=gcc&r1=1.521&r2=1.522
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.5802&r2=1.5803
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf-uninit.c.diff?cvsroot=gcc&r1=NONE&r2=1.1



-- 


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


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

* [Bug debug/21828] [4.0 Regression] debug info omitted for uninitialized variables
  2005-05-30 18:49 [Bug debug/21828] New: [4.1 Regression] stabs debug info completely broken? bonzini at gcc dot gnu dot org
                   ` (22 preceding siblings ...)
  2005-07-22 17:43 ` cvs-commit at gcc dot gnu dot org
@ 2005-07-22 17:46 ` mmitchel at gcc dot gnu dot org
  2005-07-22 19:34 ` cvs-commit at gcc dot gnu dot org
                   ` (9 subsequent siblings)
  33 siblings, 0 replies; 35+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2005-07-22 17:46 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |mark at codesourcery dot com
                   |dot org                     |
             Status|NEW                         |ASSIGNED
            Summary|[4.0/4.1 Regression] debug  |[4.0 Regression] debug info
                   |info omitted for            |omitted for uninitialized
                   |uninitialized variables     |variables


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


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

* [Bug debug/21828] [4.0 Regression] debug info omitted for uninitialized variables
  2005-05-30 18:49 [Bug debug/21828] New: [4.1 Regression] stabs debug info completely broken? bonzini at gcc dot gnu dot org
                   ` (23 preceding siblings ...)
  2005-07-22 17:46 ` [Bug debug/21828] [4.0 " mmitchel at gcc dot gnu dot org
@ 2005-07-22 19:34 ` cvs-commit at gcc dot gnu dot org
  2005-07-22 19:48 ` mmitchel at gcc dot gnu dot org
                   ` (8 subsequent siblings)
  33 siblings, 0 replies; 35+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2005-07-22 19:34 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2005-07-22 19:33 -------
Subject: Bug 21828

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-4_0-branch
Changes by:	mmitchel@gcc.gnu.org	2005-07-22 19:33:16

Modified files:
	gcc            : ChangeLog toplev.c varasm.c 
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/gcc.dg/debug/dwarf2: dwarf-uninit.c 

Log message:
	PR debug/21828
	* toplev.c (check_global_declarations): Do not mark undefined
	variables as DECL_IGNORED_P.
	* varasm.c (first_global_object_name): GTY it.
	(weak_global_object_name): Likewise.
	(notice_global_symbol): Use ggc_strdup, not xstrdup, when creating
	a string to go into {weak,first}_global_object_name.
	
	PR debug/21828
	* gcc.dg/debug/dwarf2/dwarf-uninit.c: New test.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=2.7592.2.327&r2=2.7592.2.328
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/toplev.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.944.2.4&r2=1.944.2.5
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/varasm.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.477.6.12&r2=1.477.6.13
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.5084.2.293&r2=1.5084.2.294
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/debug/dwarf2/dwarf-uninit.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=NONE&r2=1.1.2.1



-- 


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


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

* [Bug debug/21828] [4.0 Regression] debug info omitted for uninitialized variables
  2005-05-30 18:49 [Bug debug/21828] New: [4.1 Regression] stabs debug info completely broken? bonzini at gcc dot gnu dot org
                   ` (24 preceding siblings ...)
  2005-07-22 19:34 ` cvs-commit at gcc dot gnu dot org
@ 2005-07-22 19:48 ` mmitchel at gcc dot gnu dot org
  2005-07-22 20:45 ` hjl at lucon dot org
                   ` (7 subsequent siblings)
  33 siblings, 0 replies; 35+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2005-07-22 19:48 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From mmitchel at gcc dot gnu dot org  2005-07-22 19:34 -------
Fixed in 4.0.2.

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


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


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

* [Bug debug/21828] [4.0 Regression] debug info omitted for uninitialized variables
  2005-05-30 18:49 [Bug debug/21828] New: [4.1 Regression] stabs debug info completely broken? bonzini at gcc dot gnu dot org
                   ` (25 preceding siblings ...)
  2005-07-22 19:48 ` mmitchel at gcc dot gnu dot org
@ 2005-07-22 20:45 ` hjl at lucon dot org
  2005-07-22 20:49 ` hjl at lucon dot org
                   ` (6 subsequent siblings)
  33 siblings, 0 replies; 35+ messages in thread
From: hjl at lucon dot org @ 2005-07-22 20:45 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From hjl at lucon dot org  2005-07-22 20:44 -------
Mark, your patch caused bug 18556 to fail on Linux/ia64 again.

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


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


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

* [Bug debug/21828] [4.0 Regression] debug info omitted for uninitialized variables
  2005-05-30 18:49 [Bug debug/21828] New: [4.1 Regression] stabs debug info completely broken? bonzini at gcc dot gnu dot org
                   ` (26 preceding siblings ...)
  2005-07-22 20:45 ` hjl at lucon dot org
@ 2005-07-22 20:49 ` hjl at lucon dot org
  2005-07-22 20:50 ` mark at codesourcery dot com
                   ` (5 subsequent siblings)
  33 siblings, 0 replies; 35+ messages in thread
From: hjl at lucon dot org @ 2005-07-22 20:49 UTC (permalink / raw)
  To: gcc-bugs



-- 
Bug 21828 depends on bug 18556, which changed state.

Bug 18556 Summary: [4.0 Regression] C++ debug is broken
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18556

           What    |Old Value                   |New Value
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|FIXED                       |

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


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

* [Bug debug/21828] [4.0 Regression] debug info omitted for uninitialized variables
  2005-05-30 18:49 [Bug debug/21828] New: [4.1 Regression] stabs debug info completely broken? bonzini at gcc dot gnu dot org
                   ` (27 preceding siblings ...)
  2005-07-22 20:49 ` hjl at lucon dot org
@ 2005-07-22 20:50 ` mark at codesourcery dot com
  2005-07-22 20:55 ` hjl at lucon dot org
                   ` (4 subsequent siblings)
  33 siblings, 0 replies; 35+ messages in thread
From: mark at codesourcery dot com @ 2005-07-22 20:50 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From mark at codesourcery dot com  2005-07-22 20:49 -------
Subject: Re:  [4.0 Regression] debug info omitted for uninitialized
 variables

hjl at lucon dot org wrote:
> ------- Additional Comments From hjl at lucon dot org  2005-07-22 20:44 -------
> Mark, your patch caused bug 18556 to fail on Linux/ia64 again.

HJ --

Please reclose 21828.  Other bugs coming back have nothing to do with 21828.



-- 


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


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

* [Bug debug/21828] [4.0 Regression] debug info omitted for uninitialized variables
  2005-05-30 18:49 [Bug debug/21828] New: [4.1 Regression] stabs debug info completely broken? bonzini at gcc dot gnu dot org
                   ` (28 preceding siblings ...)
  2005-07-22 20:50 ` mark at codesourcery dot com
@ 2005-07-22 20:55 ` hjl at lucon dot org
  2005-07-22 21:02 ` mark at codesourcery dot com
                   ` (3 subsequent siblings)
  33 siblings, 0 replies; 35+ messages in thread
From: hjl at lucon dot org @ 2005-07-22 20:55 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From hjl at lucon dot org  2005-07-22 20:53 -------
I am closing it now. Since bug 21828 and bug 18556 are closely related, how
can we make sure that fixing one won't break the other? Should I open a new
meta bug?

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


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


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

* [Bug debug/21828] [4.0 Regression] debug info omitted for uninitialized variables
  2005-05-30 18:49 [Bug debug/21828] New: [4.1 Regression] stabs debug info completely broken? bonzini at gcc dot gnu dot org
                   ` (29 preceding siblings ...)
  2005-07-22 20:55 ` hjl at lucon dot org
@ 2005-07-22 21:02 ` mark at codesourcery dot com
  2005-07-22 21:10 ` pinskia at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  33 siblings, 0 replies; 35+ messages in thread
From: mark at codesourcery dot com @ 2005-07-22 21:02 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From mark at codesourcery dot com  2005-07-22 21:02 -------
Subject: Re:  [4.0 Regression] debug info omitted for uninitialized
 variables

hjl at lucon dot org wrote:
> ------- Additional Comments From hjl at lucon dot org  2005-07-22 20:53 -------
> I am closing it now. Since bug 21828 and bug 18556 are closely related, how
> can we make sure that fixing one won't break the other? Should I open a new
> meta bug?

I don't think that's necessary.

There are already lots of pointers back and forth, and I tested the 
eh53.C test case in developing the fix for PR 21828.



-- 


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


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

* [Bug debug/21828] [4.0 Regression] debug info omitted for uninitialized variables
  2005-05-30 18:49 [Bug debug/21828] New: [4.1 Regression] stabs debug info completely broken? bonzini at gcc dot gnu dot org
                   ` (30 preceding siblings ...)
  2005-07-22 21:02 ` mark at codesourcery dot com
@ 2005-07-22 21:10 ` pinskia at gcc dot gnu dot org
  2005-07-22 23:31 ` dpatel at apple dot com
  2005-07-22 23:48 ` mark at codesourcery dot com
  33 siblings, 0 replies; 35+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-07-22 21:10 UTC (permalink / raw)
  To: gcc-bugs



-- 
Bug 21828 depends on bug 18556, which changed state.

Bug 18556 Summary: [4.0 Regression] C++ debug is broken
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18556

           What    |Old Value                   |New Value
----------------------------------------------------------------------------
             Status|REOPENED                    |RESOLVED
         Resolution|                            |FIXED

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


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

* [Bug debug/21828] [4.0 Regression] debug info omitted for uninitialized variables
  2005-05-30 18:49 [Bug debug/21828] New: [4.1 Regression] stabs debug info completely broken? bonzini at gcc dot gnu dot org
                   ` (31 preceding siblings ...)
  2005-07-22 21:10 ` pinskia at gcc dot gnu dot org
@ 2005-07-22 23:31 ` dpatel at apple dot com
  2005-07-22 23:48 ` mark at codesourcery dot com
  33 siblings, 0 replies; 35+ messages in thread
From: dpatel at apple dot com @ 2005-07-22 23:31 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From dpatel at apple dot com  2005-07-22 23:29 -------
Subject: Re:  [4.0 Regression] debug info omitted for uninitialized variables


On Jul 22, 2005, at 12:33 PM, cvs-commit at gcc dot gnu dot org wrote:

>
> ------- Additional Comments From cvs-commit at gcc dot gnu dot org   
> 2005-07-22 19:33 -------
> Subject: Bug 21828
>
> CVSROOT:    /cvs/gcc
> Module name:    gcc
> Branch:     gcc-4_0-branch
> Changes by:    mmitchel@gcc.gnu.org    2005-07-22 19:33:16
>
> Modified files:
>     gcc            : ChangeLog toplev.c varasm.c
>     gcc/testsuite  : ChangeLog
> Added files:
>     gcc/testsuite/gcc.dg/debug/dwarf2: dwarf-uninit.c
>
> Log message:
>     PR debug/21828
>     * toplev.c (check_global_declarations): Do not mark undefined
>     variables as DECL_IGNORED_P.
>     * varasm.c (first_global_object_name): GTY it.
>     (weak_global_object_name): Likewise.
>     (notice_global_symbol): Use ggc_strdup, not xstrdup, when creating
>     a string to go into {weak,first}_global_object_name.
>
>     PR debug/21828
>     * gcc.dg/debug/dwarf2/dwarf-uninit.c: New test.
>
> Patches:
> http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff? 
> cvsroot=gcc&only_with_tag=gcc-4_0- 
> branch&r1=2.7592.2.327&r2=2.7592.2.328
> http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/toplev.c.diff? 
> cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.944.2.4&r2=1.944.2.5
> http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/varasm.c.diff? 
> cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.477.6.12&r2=1.477.6.13
> http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ 
> ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-4_0- 
> branch&r1=1.5084.2.293&r2=1.5084.2.294
> http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/ 
> debug/dwarf2/dwarf-uninit.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0- 
> branch&r1=NONE&r2=1.1.2.1
>

After this check-in :

$ cat t.c
static int foo;
int bar;
int main(void)
{
   foo += 3;
   bar *= 5;
   return 0;
}

$ xgcc -g  -O2 -o t t.c
$ cat gdbcmds
b main
ptype foo
ptype bar
p foo
p bar
$ gdb --batch -x gdbcmds t
Reading symbols for shared libraries ... done
Breakpoint 1 at 0x2d14: file t.c, line 6.
type = <unknown type>
type = <unknown type>
$1 = <unknown type>
$2 = <unknown type>

This is on powerpc-darwin. I expected this patch to fix this. Am I  
missing something ?

Thanks,
-
Devang


-- 


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


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

* [Bug debug/21828] [4.0 Regression] debug info omitted for uninitialized variables
  2005-05-30 18:49 [Bug debug/21828] New: [4.1 Regression] stabs debug info completely broken? bonzini at gcc dot gnu dot org
                   ` (32 preceding siblings ...)
  2005-07-22 23:31 ` dpatel at apple dot com
@ 2005-07-22 23:48 ` mark at codesourcery dot com
  33 siblings, 0 replies; 35+ messages in thread
From: mark at codesourcery dot com @ 2005-07-22 23:48 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From mark at codesourcery dot com  2005-07-22 23:43 -------
Subject: Re:  [4.0 Regression] debug info omitted for uninitialized
 variables

Devang Patel wrote:
>
> $ gdb --batch -x gdbcmds t
> Reading symbols for shared libraries ... done
> Breakpoint 1 at 0x2d14: file t.c, line 6.
> type = <unknown type>
> type = <unknown type>
> $1 = <unknown type>
> $2 = <unknown type>
> 
> This is on powerpc-darwin. I expected this patch to fix this. Am I  
> missing something ?

First, your example was not the one in the original bug report.

Second, you're using STABS, not DWARF-2.  I suspect the stabs debug 
generator, or the GDB stabs reader is not as good as DWARF.

On GNU/Linux, GDB knows that "bar" has type "int".  It still doesn't 
know the type of "foo"; apparently too much of the debug information is 
optimized away.  But, that's some other problem -- perhaps in GDB 
itself.  The information is clearly there for it:

         .uleb128 0x2    # (DIE (0x2d) DW_TAG_variable)
         .ascii "foo\0"  # DW_AT_name
         .byte   0x1     # DW_AT_decl_file
         .byte   0x1     # DW_AT_decl_line
         .long   0x38    # DW_AT_type
         .uleb128 0x3    # (DIE (0x38) DW_TAG_base_type)
         .ascii "int\0"  # DW_AT_name
         .byte   0x4     # DW_AT_byte_size
         .byte   0x5     # DW_AT_encoding



-- 


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


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

end of thread, other threads:[~2005-07-22 23:43 UTC | newest]

Thread overview: 35+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-05-30 18:49 [Bug debug/21828] New: [4.1 Regression] stabs debug info completely broken? bonzini at gcc dot gnu dot org
2005-05-31  5:38 ` [Bug debug/21828] " dje at gcc dot gnu dot org
2005-05-31 13:15 ` [Bug debug/21828] [4.0/4.1 Regression] debug info omitted for global variables bonzini at gcc dot gnu dot org
2005-06-05 23:48 ` mmitchel at gcc dot gnu dot org
2005-06-05 23:50 ` pinskia at gcc dot gnu dot org
2005-06-06  0:16 ` mark at codesourcery dot com
2005-06-06  0:21 ` mmitchel at gcc dot gnu dot org
2005-06-06  0:47 ` mmitchel at gcc dot gnu dot org
2005-07-04 17:54 ` pinskia at gcc dot gnu dot org
2005-07-04 17:59 ` hjl at lucon dot org
2005-07-04 18:21 ` hjl at lucon dot org
2005-07-04 20:06 ` [Bug debug/21828] [4.0/4.1 Regression] debug info omitted for uninitialized variables hjl at lucon dot org
2005-07-05  6:09 ` hjl at lucon dot org
2005-07-05 16:56 ` hjl at lucon dot org
2005-07-08  0:46 ` wilson at specifix dot com
2005-07-08  1:44 ` mmitchel at gcc dot gnu dot org
2005-07-08  2:01 ` mark at codesourcery dot com
2005-07-19 23:36 ` dpatel at apple dot com
2005-07-20 12:31 ` jakub at redhat dot com
2005-07-20 14:47 ` mark at codesourcery dot com
2005-07-21 23:26 ` mmitchel at gcc dot gnu dot org
2005-07-22  6:52 ` mark at codesourcery dot com
2005-07-22  7:14 ` mark at codesourcery dot com
2005-07-22 17:43 ` cvs-commit at gcc dot gnu dot org
2005-07-22 17:46 ` [Bug debug/21828] [4.0 " mmitchel at gcc dot gnu dot org
2005-07-22 19:34 ` cvs-commit at gcc dot gnu dot org
2005-07-22 19:48 ` mmitchel at gcc dot gnu dot org
2005-07-22 20:45 ` hjl at lucon dot org
2005-07-22 20:49 ` hjl at lucon dot org
2005-07-22 20:50 ` mark at codesourcery dot com
2005-07-22 20:55 ` hjl at lucon dot org
2005-07-22 21:02 ` mark at codesourcery dot com
2005-07-22 21:10 ` pinskia at gcc dot gnu dot org
2005-07-22 23:31 ` dpatel at apple dot com
2005-07-22 23:48 ` mark at codesourcery dot com

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).