[Bug debug/21828] [4.0/4.1 Regression] debug info omitted for uninitialized variables

2005-07-22 Thread cvs-commit at gcc dot gnu dot org

--- 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: [EMAIL PROTECTED]   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


[Bug debug/21828] [4.0/4.1 Regression] debug info omitted for uninitialized variables

2005-07-21 Thread mark at codesourcery dot com

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


[Bug debug/21828] [4.0/4.1 Regression] debug info omitted for uninitialized variables

2005-07-21 Thread mark at codesourcery dot com

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


[Bug debug/21828] [4.0/4.1 Regression] debug info omitted for uninitialized variables

2005-07-21 Thread mmitchel at gcc dot gnu dot org

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


[Bug debug/21828] [4.0/4.1 Regression] debug info omitted for uninitialized variables

2005-07-20 Thread mark at codesourcery dot com

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


[Bug debug/21828] [4.0/4.1 Regression] debug info omitted for uninitialized variables

2005-07-20 Thread jakub at redhat dot com

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


[Bug debug/21828] [4.0/4.1 Regression] debug info omitted for uninitialized variables

2005-07-19 Thread dpatel at apple dot com

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


[Bug debug/21828] [4.0/4.1 Regression] debug info omitted for uninitialized variables

2005-07-07 Thread mark at codesourcery dot com

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


[Bug debug/21828] [4.0/4.1 Regression] debug info omitted for uninitialized variables

2005-07-07 Thread mmitchel at gcc dot gnu dot org


-- 
   What|Removed |Added

   Target Milestone|4.0.1   |4.0.2


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


[Bug debug/21828] [4.0/4.1 Regression] debug info omitted for uninitialized variables

2005-07-07 Thread wilson at specifix dot com

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


[Bug debug/21828] [4.0/4.1 Regression] debug info omitted for uninitialized variables

2005-07-05 Thread hjl at lucon dot org

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


[Bug debug/21828] [4.0/4.1 Regression] debug info omitted for uninitialized variables

2005-07-04 Thread hjl at lucon dot org

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


[Bug debug/21828] [4.0/4.1 Regression] debug info omitted for uninitialized variables

2005-07-04 Thread hjl at lucon dot org

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