Launchpad has imported 33 comments from the remote bug at
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=27574.

If you reply to an imported comment from within Launchpad, your comment
will be sent to the remote bug automatically. Read more about
Launchpad's inter-bugtracker facilities at
https://documentation.ubuntu.com/launchpad/user/reference/bugs/multi-project-bugs/about-multi-project-bugs/#bugs-in-external-trackers.

------------------------------------------------------------------------
On 2006-05-12T16:53:21+00:00 Amylaar wrote:

Compilation with -O0 -g no longer creates debug information for all
variables.

Reply at:
https://bugs.launchpad.net/ubuntu/+source/gcc-4.2/+bug/336391/comments/0

------------------------------------------------------------------------
On 2006-05-12T16:58:27+00:00 Amylaar wrote:

Created attachment 11447
test case

Compiled for either sh-elf or i686-pc-linux-gnu, currrent mainline cc1plus does
not generate any debug information for the variable 'problem'.

Reply at:
https://bugs.launchpad.net/ubuntu/+source/gcc-4.2/+bug/336391/comments/1

------------------------------------------------------------------------
On 2006-05-12T17:02:39+00:00 Amylaar wrote:

Created attachment 11448
With the translation result for this file, the testcase can be linked

This file provides a definition of main and f so that when this file and
the test case are translated to an object file, they can be linked together
so that you can observe gdb showing - or rather not showing - the variable
named "problem".

Reply at:
https://bugs.launchpad.net/ubuntu/+source/gcc-4.2/+bug/336391/comments/2

------------------------------------------------------------------------
On 2006-05-12T17:11:45+00:00 Pinskia wrote:

Confirmed.

Reply at:
https://bugs.launchpad.net/ubuntu/+source/gcc-4.2/+bug/336391/comments/3

------------------------------------------------------------------------
On 2006-05-25T02:34:51+00:00 Mmitchel-gcc wrote:

Will not be fixed in 4.1.1; adjust target milestone to 4.1.2.

Reply at:
https://bugs.launchpad.net/ubuntu/+source/gcc-4.2/+bug/336391/comments/4

------------------------------------------------------------------------
On 2006-07-22T20:05:00+00:00 Drow-l wrote:

I am not going to track down what did it, but something has fixed this
on the 4.2 branch.  I can reproduce it on Debian's 4.1 branch snapshot.
If someone wants to fix it on 4.1, it should probably be easy to use the
regression hunter to identify what patch caused the string "problem" to
appear in the assembly output.  It is probably something in the last two
and a half months, since the bug was reported, but I do not see any
obvious candidates.

Reply at:
https://bugs.launchpad.net/ubuntu/+source/gcc-4.2/+bug/336391/comments/5

------------------------------------------------------------------------
On 2006-07-25T12:14:46+00:00 Amylaar wrote:

(In reply to comment #5)
> I am not going to track down what did it, but something has fixed this on the
> 4.2 branch.  I can reproduce it on Debian's 4.1 branch snapshot.  If someone
> wants to fix it on 4.1, it should probably be easy to use the regression 
> hunter
> to identify what patch caused the string "problem" to appear in the assembly
> output.  It is probably something in the last two and a half months, since the
> bug was reported, but I do not see any obvious candidates.
> 
If this is fixed on mainline, the fix must be rather recent; I see this still 
failing with
r115417: GNU C++ version 4.2.0 20060713 (experimental).
What is the oldest gcc 4.2 version where you saw this work?


Reply at: 
https://bugs.launchpad.net/ubuntu/+source/gcc-4.2/+bug/336391/comments/6

------------------------------------------------------------------------
On 2006-07-25T13:27:50+00:00 Drow-l wrote:

Subject: Re:  [4.1 Regression] MIssing debug info at -O0 for a local
variable in a C++ constructor

On Tue, Jul 25, 2006 at 12:14:46PM -0000, amylaar at gcc dot gnu dot org wrote:
> If this is fixed on mainline, the fix must be rather recent; I see this still
> failing with
> r115417: GNU C++ version 4.2.0 20060713 (experimental).
> What is the oldest gcc 4.2 version where you saw this work?

I tested it on HEAD on the day I posted (2006-07-22).  Could you check
whether that works for you, or it's something environmental?


Reply at:
https://bugs.launchpad.net/ubuntu/+source/gcc-4.2/+bug/336391/comments/7

------------------------------------------------------------------------
On 2006-07-25T17:08:17+00:00 Joern-rennecke wrote:

Subject: Re:  [4.1 Regression] MIssing debug info at -O0 for a local
variable in a C++ constructor

drow at false dot org wrote:

>------- Comment #7 from drow at gcc dot gnu dot org  2006-07-25 13:27 -------
>Subject: Re:  [4.1 Regression] MIssing debug info at -O0 for a local variable
>in a C++ constructor
>
>On Tue, Jul 25, 2006 at 12:14:46PM -0000, amylaar at gcc dot gnu dot org wrote:
>  
>
>>If this is fixed on mainline, the fix must be rather recent; I see this still
>>failing with
>>r115417: GNU C++ version 4.2.0 20060713 (experimental).
>>What is the oldest gcc 4.2 version where you saw this work?
>>    
>>
>
>I tested it on HEAD on the day I posted (2006-07-22).  Could you check
>whether that works for you, or it's something environmental?
>  
>
When I compile the testcase (using -g -O0) with a cc1plus built from todays
sources (r115734), a test search for "problem" in the .s file comes up 
empty.
OTOH, both a native and a cross build eventually failed.

Can you find out the exact version of gcc that you tested?


Reply at: 
https://bugs.launchpad.net/ubuntu/+source/gcc-4.2/+bug/336391/comments/8

------------------------------------------------------------------------
On 2006-07-25T20:43:19+00:00 Amylaar wrote:

Created attachment 11938
g++.dg/debug test case

As far as I can tell, as a g++.dg/debug test case, this passes for stabs, but
fails for dwarf.

Reply at:
https://bugs.launchpad.net/ubuntu/+source/gcc-4.2/+bug/336391/comments/9

------------------------------------------------------------------------
On 2006-07-26T03:52:08+00:00 Drow-l wrote:

Subject: Re:  [4.1 Regression] MIssing debug info at -O0 for a local
variable in a C++ constructor

On Tue, Jul 25, 2006 at 05:08:18PM -0000, joern dot rennecke at st dot com 
wrote:
> When I compile the testcase (using -g -O0) with a cc1plus built from todays
> sources (r115734), a test search for "problem" in the .s file comes up 
> empty.
> OTOH, both a native and a cross build eventually failed.
> 
> Can you find out the exact version of gcc that you tested?

Now it fails.  What the heck?

The problem is that an abstract instance of 'problem' is never emitted. 
For the two concrete instances we try to reference the abstract copy
but there isn't one.  The variable is emitted, but without a name.

The first abstract instance of A::A is a declaration.  Later a
"definition" (still abstract) is seen.  But its DECL_INITIAL is
error_mark_node!

If I had to guess I'd say that this was a C++ front end problem, or
maybe a recent change in cgraph.  I don't have time to debug it further
right now.  The abstract copy of the function has to have a body, or
dwarf2out has no structure with which to describe the local variables.


Reply at:
https://bugs.launchpad.net/ubuntu/+source/gcc-4.2/+bug/336391/comments/10

------------------------------------------------------------------------
On 2006-07-26T12:30:30+00:00 Amylaar wrote:

(In reply to comment #10)
 > If I had to guess I'd say that this was a C++ front end problem, or
> maybe a recent change in cgraph.

It can't have been a particularly recent change, since it already failed
with GNU C++ version 4.1.0 20050323 (experimental) (sh-elf) .
It worked with GNU C++ version 4.1.0 20050314 (experimental) (sh-elf) .

Reply at:
https://bugs.launchpad.net/ubuntu/+source/gcc-4.2/+bug/336391/comments/11

------------------------------------------------------------------------
On 2006-07-26T13:59:33+00:00 Drow-l wrote:

It is a cgraph change.  There were several patches affecting
cgraph_remove_node during this time period; it was probably one of
those.  The problem is that we throw away the body of the abstract copy
of the constructor, before we get around to emitting debug information
for it.

There's already a debug hook at what looks like the right time.  It's
just not used for dwarf2: deferred_inline_function.  It was replaced by
outlining_inline_function, which is called only when we know we'll
generate a concrete instance.

There's a couple of things we could do:
  - Not throw away the body.
  - Try to generate the debug info earlier, and then prune it if it isn't 
needed.
  - Try to treat one of the concrete clones (whose bodies we need) as the 
origin.

I think the first one is going to be safest for now.

I don't really see how to do it.  Jan, do you have a suggestion?

Reply at:
https://bugs.launchpad.net/ubuntu/+source/gcc-4.2/+bug/336391/comments/12

------------------------------------------------------------------------
On 2006-07-27T17:29:38+00:00 Amylaar wrote:

(In reply to comment #12)
> It is a cgraph change.  There were several patches affecting 
> cgraph_remove_node
> during this time period; it was probably one of those.

The problem appeared from r96653 to r96654; AFAICT this is the gcc-patches
posting for the associated patch: 
http://gcc.gnu.org/ml/gcc-patches/2005-03/msg01709.html

Reply at:
https://bugs.launchpad.net/ubuntu/+source/gcc-4.2/+bug/336391/comments/13

------------------------------------------------------------------------
On 2006-07-27T20:12:45+00:00 Drow-l wrote:

Subject: Re:  [4.1/4.2 Regression] MIssing debug info at -O0 for a local
variable in a C++ constructor

On Thu, Jul 27, 2006 at 05:29:38PM -0000, amylaar at gcc dot gnu dot org wrote:
> The problem appeared from r96653 to r96654; AFAICT this is the gcc-patches
> posting for the associated patch:
> http://gcc.gnu.org/ml/gcc-patches/2005-03/msg01709.html

Jan and Dan Berlin suggested that the right fix for this bug might be
to not register the uncloned constructor with cgraph, only the clones.


Reply at:
https://bugs.launchpad.net/ubuntu/+source/gcc-4.2/+bug/336391/comments/14

------------------------------------------------------------------------
On 2006-08-25T18:57:16+00:00 Drow-l wrote:

I don't think I can sort this one out.  I think the easiest solution
will be to check when marking a function as reachable whether it has an
abstract origin, and if so set a flag in the abstract origin preventing
its body from being killed, but I can't keep track of all the other
similar-but-not-quite-the-same flags in cgraph.

Reply at:
https://bugs.launchpad.net/ubuntu/+source/gcc-4.2/+bug/336391/comments/15

------------------------------------------------------------------------
On 2008-01-13T13:02:20+00:00 Pinskia wrote:

*** Bug 34767 has been marked as a duplicate of this bug. ***

Reply at:
https://bugs.launchpad.net/ubuntu/+source/gcc-4.2/+bug/336391/comments/16

------------------------------------------------------------------------
On 2008-01-13T14:04:00+00:00 Rguenth wrote:

Honza, can you have a look here?

Reply at:
https://bugs.launchpad.net/ubuntu/+source/gcc-4.2/+bug/336391/comments/17

------------------------------------------------------------------------
On 2008-02-15T21:27:18+00:00 Pinskia wrote:

*** Bug 35212 has been marked as a duplicate of this bug. ***

Reply at:
https://bugs.launchpad.net/ubuntu/+source/gcc-4.2/+bug/336391/comments/18

------------------------------------------------------------------------
On 2008-02-15T21:29:29+00:00 Pinskia wrote:

I don't know if this is the correct patch but we made this for the PS3 
toolchain:
Index: gcc/cgraph.c
===================================================================
--- gcc/cgraph.c        (revision 2280)
+++ gcc/cgraph.c        (working copy)
@@ -476,14 +476,16 @@
       if (!n->next_clone && !n->global.inlined_to
          && (cgraph_global_info_ready
              && (TREE_ASM_WRITTEN (n->decl) || DECL_EXTERNAL (n->decl))))
-       kill_body = true;
+       {
+         DECL_INITIAL (node->decl) = error_mark_node;
+         kill_body = true;
+       }
     }
 
   if (kill_body && !dump_enabled_p (TDI_tree_all) && flag_unit_at_a_time)
     {
       DECL_SAVED_TREE (node->decl) = NULL;
       DECL_STRUCT_FUNCTION (node->decl) = NULL;
-      DECL_INITIAL (node->decl) = error_mark_node;
     }
   cgraph_n_nodes--;
   /* Do not free the structure itself so the walk over chain can continue.  */

Reply at:
https://bugs.launchpad.net/ubuntu/+source/gcc-4.2/+bug/336391/comments/19

------------------------------------------------------------------------
On 2008-04-01T07:11:38+00:00 Pinskia wrote:

I am just going to test this patch and relook at it when the test is
finished but I can see what the issue is.  at -O0 we have unit-at-a-time
on.  Though there is still an issue if we don't have any clones, I
think.  I will relook more into it after the bootstrap/test finishes.

Reply at:
https://bugs.launchpad.net/ubuntu/+source/gcc-4.2/+bug/336391/comments/20

------------------------------------------------------------------------
On 2008-04-23T22:33:38+00:00 Ian Lance Taylor wrote:

A patch like this seems like a decent workaround to me.

Honza, any opinions on this approach?

Ian

Index: cgraph.c
===================================================================
--- cgraph.c    (revision 134283)
+++ cgraph.c    (working copy)
@@ -615,6 +615,14 @@ cgraph_remove_node (struct cgraph_node *
        kill_body = true;
     }
 
+  /* We don't release the body of abstract functions, because they may
+     be needed when emitting debugging information.  In particular
+     this will happen for C++ constructors/destructors.  FIXME:
+     Ideally we would check to see whether there are any reachable
+     functions whose DECL_ABSTRACT_ORIGIN points to this decl.  */
+  if (DECL_ABSTRACT (node->decl))
+    kill_body = false;
+
   if (kill_body && flag_unit_at_a_time)
     cgraph_release_function_body (node);
   node->decl = NULL;


Reply at: 
https://bugs.launchpad.net/ubuntu/+source/gcc-4.2/+bug/336391/comments/21

------------------------------------------------------------------------
On 2008-04-23T23:08:49+00:00 Pinskia wrote:

(In reply to comment #21)
> A patch like this seems like a decent workaround to me.
> 
> Honza, any opinions on this approach?

This looks good to me also.

Reply at:
https://bugs.launchpad.net/ubuntu/+source/gcc-4.2/+bug/336391/comments/22

------------------------------------------------------------------------
On 2008-07-04T21:22:26+00:00 Jsm28 wrote:

Closing 4.1 branch.


Reply at: 
https://bugs.launchpad.net/ubuntu/+source/gcc-4.2/+bug/336391/comments/23

------------------------------------------------------------------------
On 2008-11-06T10:24:35+00:00 Dodji-gcc wrote:

So the patch http://gcc.gnu.org/ml/gcc-patches/2008-11/msg00133.html
that fixes this got accepted. So this might end up in trunk soon.

For 4.3 and 4.2 we might want to apply Ian's patch as it is less
disruptive.

See http://gcc.gnu.org/ml/gcc-patches/2008-09/msg01981.html .


Reply at:
https://bugs.launchpad.net/ubuntu/+source/gcc-4.2/+bug/336391/comments/24

------------------------------------------------------------------------
On 2008-11-12T21:59:09+00:00 Dodji-gcc wrote:

Subject: Bug 27574

Author: dodji
Date: Wed Nov 12 21:57:44 2008
New Revision: 141807

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=141807
Log:
gcc/ChangeLog:
2008-11-12  Dodji Seketeli  <[email protected]>

        PR debug/27574
        * cgraph.h: New abstract_and_needed member to struct cgraph_node.
        * cgraphunit.c (cgraph_analyze_functions): Flag abstract functions
        - which clones are reachable - as "abstract and needed".
        * cgraph.c (cgraph_release_function_body):  If a node is "abstract and 
needed",
        do not release its DECL_INITIAL() content because that will be needed 
to emit
        debug info.

gcc/testsuite/ChangeLog:
2008-11-12  Dodji Seketeli  <[email protected]>

        PR debug/27574
        * g++.dg/debug/dwarf2/local-var-in-contructor.C: New test.


Added:
    trunk/gcc/testsuite/g++.dg/debug/dwarf2/local-var-in-contructor.C
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/cgraph.c
    trunk/gcc/cgraph.h
    trunk/gcc/cgraphunit.c
    trunk/gcc/final.c
    trunk/gcc/testsuite/ChangeLog


Reply at:
https://bugs.launchpad.net/ubuntu/+source/gcc-4.2/+bug/336391/comments/25

------------------------------------------------------------------------
On 2008-11-13T10:56:29+00:00 Dodji-gcc wrote:

Subject: Bug 27574

Author: dodji
Date: Thu Nov 13 10:55:01 2008
New Revision: 141819

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=141819
Log:
Fix ChangeLog entry:
        PR debug/27574
        * cgraph.h: New abstract_and_needed member to struct cgraph_node.
        * cgraphunit.c (cgraph_analyze_functions): Flag abstract functions
        - which clones are reachable - as "abstract and needed".
        * cgraph.c (cgraph_release_function_body):  If a node is
        "abstract and needed", do not release its DECL_INITIAL() content
        that will be needed to emit debug info.


Modified:
    trunk/gcc/ChangeLog


Reply at:
https://bugs.launchpad.net/ubuntu/+source/gcc-4.2/+bug/336391/comments/26

------------------------------------------------------------------------
On 2008-11-14T13:28:25+00:00 Dodji-gcc wrote:

Subject: Bug 27574

Author: dodji
Date: Fri Nov 14 13:26:59 2008
New Revision: 141858

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=141858
Log:
gcc/ChangeLog:
        PR debug/27574
        * cgraph.h: New abstract_and_needed member to struct cgraph_node.
        * cgraphunit.c (cgraph_analyze_functions): Flag abstract functions
        -which clones are reachable - as "abstract and needed".
        * cgraph.c (cgraph_release_function_body):  If a node is
        "abstract and needed", do not release its DECL_INITIAL() content
        will be needed to emit debug info.

gcc/testsuite/ChangeLog:
        PR debug/27574
        * g++.dg/debug/dwarf2/local-var-in-contructor.C: New test.


Added:
    
branches/gcc-4_3-branch/gcc/testsuite/g++.dg/debug/dwarf2/local-var-in-contructor.C
Modified:
    branches/gcc-4_3-branch/gcc/ChangeLog
    branches/gcc-4_3-branch/gcc/cgraph.c
    branches/gcc-4_3-branch/gcc/cgraph.h
    branches/gcc-4_3-branch/gcc/cgraphunit.c
    branches/gcc-4_3-branch/gcc/final.c
    branches/gcc-4_3-branch/gcc/testsuite/ChangeLog


Reply at:
https://bugs.launchpad.net/ubuntu/+source/gcc-4.2/+bug/336391/comments/27

------------------------------------------------------------------------
On 2008-11-19T00:17:22+00:00 Dodji-gcc wrote:

Subject: Bug 27574

Author: dodji
Date: Wed Nov 19 00:15:52 2008
New Revision: 141984

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=141984
Log:
gcc/ChangeLog:
2008-11-14  Dodji Seketeli  <[email protected]>

        PR c++/27574
        * gcc/cgraph.c (cgraph_remove_node): Do not remove the body of
          abstract functions. It might be useful to emit debugging
          information. This is a patch from Ian Lance Taylor.
        * cgraphunit.c (cgraph_optimize): Do not cry when bodies of abstract
          functions are still around. They are useful to output debug info.

gcc/testsuite/ChangeLog
2008-11-14  Dodji Seketeli  <[email protected]>

        PR c++/27574
        * testsuite/g++.dg/debug/dwarf2/dwarf2.exp: Backport this here from
        gcc-4_3-branch.
        * g++.dg/debug/dwarf2/local-var-in-contructor.C: New testcase.

Added:
    branches/gcc-4_2-branch/gcc/testsuite/g++.dg/debug/dwarf2/
    branches/gcc-4_2-branch/gcc/testsuite/g++.dg/debug/dwarf2/dwarf2.exp
    
branches/gcc-4_2-branch/gcc/testsuite/g++.dg/debug/dwarf2/local-var-in-contructor.C
Modified:
    branches/gcc-4_2-branch/gcc/ChangeLog
    branches/gcc-4_2-branch/gcc/cgraph.c
    branches/gcc-4_2-branch/gcc/cgraphunit.c
    branches/gcc-4_2-branch/gcc/testsuite/ChangeLog


Reply at:
https://bugs.launchpad.net/ubuntu/+source/gcc-4.2/+bug/336391/comments/28

------------------------------------------------------------------------
On 2008-11-19T00:21:18+00:00 Dodji-gcc wrote:

Fixed in trunk, 4.3 and 4.2 branch.


Reply at: 
https://bugs.launchpad.net/ubuntu/+source/gcc-4.2/+bug/336391/comments/29

------------------------------------------------------------------------
On 2008-12-09T18:22:17+00:00 Amylaar wrote:

I think the testcase pr27574.C should be added to the testsuite before
closing this bug.

Reply at:
https://bugs.launchpad.net/ubuntu/+source/gcc-4.2/+bug/336391/comments/30

------------------------------------------------------------------------
On 2008-12-09T18:48:51+00:00 Amylaar wrote:

Sorry, I only checked for the presence of the original testcase name in
the testsuite, and thus missed the fact that there is a new test called
local-var-in-contructor.C [sic] .

Reply at:
https://bugs.launchpad.net/ubuntu/+source/gcc-4.2/+bug/336391/comments/31

------------------------------------------------------------------------
On 2009-04-29T15:09:09+00:00 Pinskia wrote:

*** Bug 39961 has been marked as a duplicate of this bug. ***

Reply at:
https://bugs.launchpad.net/ubuntu/+source/gcc-4.2/+bug/336391/comments/33

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/336391

Title:
  Missing debug info at -O0 for a local variable in a C++ constructor

To manage notifications about this bug go to:
https://bugs.launchpad.net/gcc/+bug/336391/+subscriptions


-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to