Bug 129841 (IT#45246) - [RHEL3 U3] missing debug info for nested class of template
Summary: [RHEL3 U3] missing debug info for nested class of template
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: IT#45246
Product: Red Hat Enterprise Linux 3
Classification: Red Hat
Component: gcc
Version: 3.0
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks: 123574
TreeView+ depends on / blocked
 
Reported: 2004-08-13 07:52 UTC by Alexandre Oliva
Modified: 2007-11-30 22:07 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2004-09-15 01:17:27 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
Patch that fixes the problem (1.40 KB, patch)
2004-08-13 08:05 UTC, Alexandre Oliva
no flags Details | Diff

Description Alexandre Oliva 2004-08-13 07:52:49 UTC
walkert@zaphod:foo$ cat bar.C
template<class T> struct X
{
    struct Y
    {
        T t;
    };
                                                                     
          
    X( ) : y( new Y ) { }
                                                                     
          
    Y* y;
};
                                                                     
          
int main( unsigned int, char** )
{
    X<int> x;  // break here
}
                                                                     
          
walkert@zaphod:foo$ gdb bar
(gdb) break main
Breakpoint 1 at 0x80484a8: file bar.C, line 15.
(gdb) run
Starting program: /ms/.global/ny.u/user/w/walkert/foo/bar
 
Breakpoint 1, main () at bar.C:15
15          X<int> x;  // break here
(gdb) print *x.y
$3 = <incomplete type>

Comment 2 Alexandre Oliva 2004-08-13 08:05:47 UTC
Created attachment 102688 [details]
Patch that fixes the problem

This problem was introduced with the patch at
http://gcc.gnu.org/ml/gcc/2003-02/msg02052.html (rth tweaked it a bit before
checking it in, but didn't post the exact patch).  It wasn't present in early
3.2 releases, and the patch was never added to 3.3, that uses a completely
different approach to avoid emitting unused debug information.

The problem is that a die for Y is initially created for the declaration only,
and add the definition die only later.	The problem is that all references to
the type point to the declaration node, not to the specification one, so the
specification one ends up being regarded as unused, and removed.

The attached patch has an assumption I'm not entirely sure we're entitled to
make, namely, that as we walk the comp unit dies in the sequence they were
generated, when we get to the die for the specification, we'll have already
marked the declaration node should it be needed.  One the good side, should the
assumption not hold, we'll end up with debug info that is no worse than what we
have now.

I've verified that the patch fixes the reported problem, and that it can build
all of libgcc and libstdc++ with debug info with the patch, but I have only
just started regression testing.

Comment 3 Alexandre Oliva 2004-08-13 09:18:40 UTC
Regression testing on i686 completed.

Comment 4 Larry Troan 2004-09-15 01:17:27 UTC
From Issue Tracker:
Event posted 08-13-2004 11:53am by thomas.walker  	
Looks good in initial testing.
--------------------------------------

Event posted 09-02-2004 10:03am by fhirtz  	
We've been able to get the priority compiler fixes in the U3 release,
thus this has been included in the gcc-3.2.3-42 release with U3.

CHANGING THIS BZ TO RESOLVED=CURRENTRELEASE FOR RHEL3 U3 (per fhirtz)


Note You need to log in before you can comment on or make changes to this bug.