[Bug debug/17924] [4.0 Regression] gcc.dg/debug/dwarf2/dwarf-die7.c fails

2005-01-03 Thread dberlin at gcc dot gnu dot org

--- Additional Comments From dberlin at gcc dot gnu dot org  2005-01-04 
03:10 ---
Fixed

-- 
   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution||FIXED


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


[Bug debug/17924] [4.0 Regression] gcc.dg/debug/dwarf2/dwarf-die7.c fails

2005-01-03 Thread cvs-commit at gcc dot gnu dot org

--- Additional Comments From cvs-commit at gcc dot gnu dot org  2005-01-04 
01:54 ---
Subject: Bug 17924

CVSROOT:/cvs/gcc
Module name:gcc
Changes by: [EMAIL PROTECTED]   2005-01-04 01:54:29

Modified files:
gcc: ChangeLog Makefile.in dwarf2out.c gimple-low.c 
 tree-inline.c tree-optimize.c tree-pass.h 

Log message:
2005-01-03  Daniel Berlin  <[EMAIL PROTECTED]>

Fix PR debug/17924
Fix PR debug/19191
* dwarf2out.c (block_ultimate_origin): Follow decl origin if origin
is a decl.
* gimple-low.c (mark_blocks_with_used_vars): New function.
(mark_blocks_with_used_subblocks): Ditto.
(mark_used_blocks): Ditto.
(pass_mark_used_blocks): New pass.
* tree-inline.c: Include debug.h.
(expand_call_inline): Call outlining_inline_function here.
* tree-optimize.c (init_tree_optimization_passes): Add
pass_mark_used_blocks.
* tree-pass.h (pass_mark_used_blocks): New.
* Makefile.in (tree-inline.o): Add debug.h dependency.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.7012&r2=2.7013
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/Makefile.in.diff?cvsroot=gcc&r1=1.1437&r2=1.1438
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/dwarf2out.c.diff?cvsroot=gcc&r1=1.564&r2=1.565
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/gimple-low.c.diff?cvsroot=gcc&r1=2.14&r2=2.15
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/tree-inline.c.diff?cvsroot=gcc&r1=1.161&r2=1.162
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/tree-optimize.c.diff?cvsroot=gcc&r1=2.66&r2=2.67
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/tree-pass.h.diff?cvsroot=gcc&r1=2.22&r2=2.23



-- 


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


[Bug debug/17924] [4.0 Regression] gcc.dg/debug/dwarf2/dwarf-die7.c fails

2005-01-01 Thread jason at redhat dot com

--- Additional Comments From jason at redhat dot com  2005-01-01 12:16 
---
Subject: Re:  [4.0 Regression]
 gcc.dg/debug/dwarf2/dwarf-die7.c fails

On 31 Dec 2004 22:46:37 -, "dberlin at gcc dot gnu dot org" <[EMAIL 
PROTECTED]> wrote:

> When we inline a C++ constructor that isn't going to be output, we get the
> following stuff:
>
> a block for the inlined constructor, with an abstract origin of:
>   a decl named __comp_ctor with an abstract origin of:
> a decl named bad_typeid

This sounds right.  The inlined constructor is an instance of a clone of a
constructor.

> we call gen_inlined_subroutine_die on the block, which calls 
> block_ultimate_origin.
> block_ultimate_origin returns *the __comp_ctor* decl.

But this is wrong.  It seems that block_ultimate_origin needs to follow
DECL_ABSTRACT_ORIGIN, too.

Jason


-- 


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


[Bug debug/17924] [4.0 Regression] gcc.dg/debug/dwarf2/dwarf-die7.c fails

2004-12-31 Thread dberlin at gcc dot gnu dot org

--- Additional Comments From dberlin at gcc dot gnu dot org  2005-01-01 
03:17 ---
Just to further followup, the change between 3.4 and 4.0 in regard to what the
abstract origin of of the block is set to is because of the "inliner for java"
code that was made the default in 4.0.
So if it is indeed a bug, i can easily fix it (it's a one line fix).


-- 


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


[Bug debug/17924] [4.0 Regression] gcc.dg/debug/dwarf2/dwarf-die7.c fails

2004-12-31 Thread dberlin at gcc dot gnu dot org

--- Additional Comments From dberlin at gcc dot gnu dot org  2004-12-31 
22:46 ---
Okay.
What really happens here is that the blocks aren't getting marked properly
because we rearrange the block tree and then the used flags aren't set when the
subblocks of a block are used (which is what we expect in the debug outputters).

However, marking the blocks properly (see the attached patch, which fixes
dwarf-die-7) exposes bugs, and  I really need someone like Jason to tell me what
the heck is going on.

The bug it exposes is as follows (and maybe the real bug is in the inliner, i've
attached a testcase here).

When we inline a C++ constructor that isn't going to be output, we get the
following stuff:

a block for the inlined constructor, with an abstract origin of:
  a decl named __comp_ctor with an abstract origin of:
a decl named bad_typeid

we call gen_inlined_subroutine_die on the block, which calls 
block_ultimate_origin.
block_ultimate_origin returns *the __comp_ctor* decl.

We call dwarf2out_abstract_function on the __comp_ctor decl, which outputs a die
for the bad_typeid decl (which is the real origin).
Then we try to add an abstract attribute for the *comp_ctor* decl, because
that's what we think the ultimate origin of the block was. 
This aborts, because we have no die for that decl (because it's not the real
ultimate origin of the block).

When compiled with 3.4, we end up with

a block for the inlined constructor, with an abstract origin of:
a decl named bad_typeid

Which works properly.

I get the feeling that block_ultimate_origin of the block is supposed to be the
same as it was in 3.4.

But the documentation doesn't help me here.

Jason, if you can tell me what the block_ultimate_origin of the block is
supposed to really be (Ie is it correct or incorrect), i can fix this bug.

You need to apply the patch to see the bug, because without the patch, we simply
don't try to output an inlined subroutine die because the superblock isn't
marked as used, etc.

-- 
   What|Removed |Added

 CC||jason at redhat dot com
Version|4.0.0   |3.4.4


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


[Bug debug/17924] [4.0 Regression] gcc.dg/debug/dwarf2/dwarf-die7.c fails

2004-12-31 Thread dberlin at gcc dot gnu dot org

--- Additional Comments From dberlin at gcc dot gnu dot org  2004-12-31 
22:25 ---
*** Bug 19191 has been marked as a duplicate of this bug. ***

-- 
   What|Removed |Added

 CC||fnf at specifixinc dot com


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


[Bug debug/17924] [4.0 Regression] gcc.dg/debug/dwarf2/dwarf-die7.c fails

2004-12-29 Thread pinskia at gcc dot gnu dot org

--- Additional Comments From pinskia at gcc dot gnu dot org  2004-12-29 
20:54 ---
Patch posted here: .

-- 
   What|Removed |Added

 AssignedTo|bje at gcc dot gnu dot org  |dberlin at gcc dot gnu dot
   ||org
   Keywords||patch


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


[Bug debug/17924] [4.0 Regression] gcc.dg/debug/dwarf2/dwarf-die7.c fails

2004-12-02 Thread dberlin at gcc dot gnu dot org

--- Additional Comments From dberlin at gcc dot gnu dot org  2004-12-03 
01:17 ---
Can't we generate the inline info in the debug info from the callgraph somehow?
After all, it seems like the only thing that knows everything about what
happened during inline, and the proper place to store such information.


-- 


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


[Bug debug/17924] [4.0 Regression] gcc.dg/debug/dwarf2/dwarf-die7.c fails

2004-12-02 Thread hubicka at ucw dot cz

--- Additional Comments From hubicka at ucw dot cz  2004-12-02 16:05 ---
Subject: Re:  [4.0 Regression] gcc.dg/debug/dwarf2/dwarf-die7.c fails

> 
> --- Additional Comments From bje at gcc dot gnu dot org  2004-12-02 05:43 
> ---
> Trivial test case:
> 
>   static int f () { return 3; } 
>   int main() { return f (); }
> 
> Here, cgraph_optimize() decides to inline f() into main() and then eliminates
> the node for f() from the call graph.  cgraph_expand_function() never emits
> assembly for f(), so no DIE is emitted either.  The cgraph dump file 
> summarises
> the situation:
> 
> Optimized callgraph:
> 
> main/1: 13 insns (5 after inlining) needed tree inlinable
>   called by: 
>   calls: f/0 (inlined) 
> f/0: (inline copy in main/1) 2 insns reachable tree local inlinable
>   called by: main/1 (inlined) 
>   calls: 
> 
> Final callgraph:
> 
> main/1: 13 insns (5 after inlining) needed inlinable asm_written
>   called by: 
>   calls: 
> 
> The dilemma here is that we really don't want to emit the real f(), since it 
> is
> never called in the translation unit and we don't want to waste text doing 
> so. 
> All we want is debugging information for f().

I thing the scheme this was supposed to work was to keep the BLOCK node
from the inlined version of f() in the DECL_INITIAL of main() so the
debug info dumper notice that function f() has been inlined and produce
the abstract insteance of it himself.

Since the BLOCK nodes are gone and we now attach debug info into
statements and we apparently succeeds to remove body of f() entirely
even without optimization we no longer do this.

I am not sure how to deal with this properly either (I am not debug info
expert).  The crude version of patch is not correct as the main point is
to be able to breakpoint inside f() and get program stopped correctly
that apparently won't work as everything about f() in main() is dead.

We even might declare this proper behaviour and simply make the function
nonempty in the testcase or we might add dummy empty statements and
maintain it around till end of compilation but that sounds involved for
such a minnor nit in dedbug info.

Honza
> 
> The following crude patch makes things work, but it's wrong:
> 
> Index: cgraphunit.c
> ===
> RCS file: /home/bje/gcc-cvs/gcc/gcc/cgraphunit.c,v
> retrieving revision 1.90
> diff -u -p -r1.90 cgraphunit.c
> --- cgraphunit.c18 Nov 2004 00:18:43 -  1.90
> +++ cgraphunit.c2 Dec 2004 05:41:16 -
> @@ -786,6 +786,14 @@ cgraph_mark_functions_to_output (void)
>   && !TREE_ASM_WRITTEN (decl)
>   && !DECL_EXTERNAL (decl))
> node->output = 1;
> +  else if (DECL_SAVED_TREE (decl)
> +  && node->global.inlined_to
> +  && !node->needed
> +  && node->reachable
> +  && node->local.local
> +  && !TREE_ASM_WRITTEN (decl)
> +  && !DECL_EXTERNAL (decl))
> +   node->output = 1;
>else
> {
>   /* We should've reclaimed all functions that are not needed.  */
> @@ -811,9 +819,6 @@ static void
>  cgraph_expand_function (struct cgraph_node *node)
>  {
>tree decl = node->decl;
> -
> -  /* We ought to not compile any inline clones.  */
> -  gcc_assert (!node->global.inlined_to);
>  
>if (flag_unit_at_a_time)
>  announce_function (decl);
> 
> Any ideas on how to proceed?
> 
> -- 
> 
> 
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17924
> 
> --- You are receiving this mail because: ---
> You are on the CC list for the bug, or are watching someone who is.


-- 


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


[Bug debug/17924] [4.0 Regression] gcc.dg/debug/dwarf2/dwarf-die7.c fails

2004-12-01 Thread bje at gcc dot gnu dot org

--- Additional Comments From bje at gcc dot gnu dot org  2004-12-02 05:43 
---
Trivial test case:

  static int f () { return 3; } 
  int main() { return f (); }

Here, cgraph_optimize() decides to inline f() into main() and then eliminates
the node for f() from the call graph.  cgraph_expand_function() never emits
assembly for f(), so no DIE is emitted either.  The cgraph dump file summarises
the situation:

Optimized callgraph:

main/1: 13 insns (5 after inlining) needed tree inlinable
  called by: 
  calls: f/0 (inlined) 
f/0: (inline copy in main/1) 2 insns reachable tree local inlinable
  called by: main/1 (inlined) 
  calls: 

Final callgraph:

main/1: 13 insns (5 after inlining) needed inlinable asm_written
  called by: 
  calls: 

The dilemma here is that we really don't want to emit the real f(), since it is
never called in the translation unit and we don't want to waste text doing so. 
All we want is debugging information for f().

The following crude patch makes things work, but it's wrong:

Index: cgraphunit.c
===
RCS file: /home/bje/gcc-cvs/gcc/gcc/cgraphunit.c,v
retrieving revision 1.90
diff -u -p -r1.90 cgraphunit.c
--- cgraphunit.c18 Nov 2004 00:18:43 -  1.90
+++ cgraphunit.c2 Dec 2004 05:41:16 -
@@ -786,6 +786,14 @@ cgraph_mark_functions_to_output (void)
  && !TREE_ASM_WRITTEN (decl)
  && !DECL_EXTERNAL (decl))
node->output = 1;
+  else if (DECL_SAVED_TREE (decl)
+  && node->global.inlined_to
+  && !node->needed
+  && node->reachable
+  && node->local.local
+  && !TREE_ASM_WRITTEN (decl)
+  && !DECL_EXTERNAL (decl))
+   node->output = 1;
   else
{
  /* We should've reclaimed all functions that are not needed.  */
@@ -811,9 +819,6 @@ static void
 cgraph_expand_function (struct cgraph_node *node)
 {
   tree decl = node->decl;
-
-  /* We ought to not compile any inline clones.  */
-  gcc_assert (!node->global.inlined_to);
 
   if (flag_unit_at_a_time)
 announce_function (decl);

Any ideas on how to proceed?

-- 


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


[Bug debug/17924] [4.0 Regression] gcc.dg/debug/dwarf2/dwarf-die7.c fails

2004-10-14 Thread bje at gcc dot gnu dot org

--- Additional Comments From bje at gcc dot gnu dot org  2004-10-15 06:43 ---
Actually, Pinski is right ;-/  gen_subprogram_die() is not being called.

-- 


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


[Bug debug/17924] [4.0 Regression] gcc.dg/debug/dwarf2/dwarf-die7.c fails

2004-10-14 Thread bje at gcc dot gnu dot org

--- Additional Comments From bje at gcc dot gnu dot org  2004-10-15 06:07 ---
gen_subprogram_die is indeed being called for the decl of `t'.
The problem seems a bit more subtle.  This program illustrates the problem:

/*
  Fails with:
  gcc foo.c -DSTATIC=static -O3 -dA -S -gdwarf-2

  Succeeds with:
  gcc foo.c -O3 -dA -S -gdwarf-2
*/

#ifndef STATIC
#define STATIC
#endif

STATIC int f () { return 3; } 
int main() { return f (); }

-- 


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


[Bug debug/17924] [4.0 Regression] gcc.dg/debug/dwarf2/dwarf-die7.c fails

2004-10-14 Thread bje at gcc dot gnu dot org


-- 
   What|Removed |Added

 AssignedTo|unassigned at gcc dot gnu   |bje at gcc dot gnu dot org
   |dot org |
 Status|NEW |ASSIGNED


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


[Bug debug/17924] [4.0 Regression] gcc.dg/debug/dwarf2/dwarf-die7.c fails

2004-10-10 Thread pinskia at gcc dot gnu dot org

--- Additional Comments From pinskia at gcc dot gnu dot org  2004-10-11 02:05 
---
The problem is that we are not calling gen_subprogram_die on the decl for the function 
t.

-- 
   What|Removed |Added

 CC||hubicka at gcc dot gnu dot
   ||org


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


[Bug debug/17924] [4.0 Regression] gcc.dg/debug/dwarf2/dwarf-die7.c fails

2004-10-10 Thread pinskia at gcc dot gnu dot org

--- Additional Comments From pinskia at gcc dot gnu dot org  2004-10-10 20:23 
---
Confirmed by every testsuite results since the tree-ssa merge.

-- 
   What|Removed |Added

 Status|UNCONFIRMED |NEW
 Ever Confirmed||1
   Last reconfirmed|-00-00 00:00:00 |2004-10-10 20:23:31
   date||
   Target Milestone|--- |4.0.0


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