Bug 129841 - (IT#45246) [RHEL3 U3] missing debug info for nested class of template
[RHEL3 U3] missing debug info for nested class of template
Status: CLOSED CURRENTRELEASE
Product: Red Hat Enterprise Linux 3
Classification: Red Hat
Component: gcc (Show other bugs)
3.0
All Linux
medium Severity medium
: ---
: ---
Assigned To: Jakub Jelinek
:
Depends On:
Blocks: 123574
  Show dependency treegraph
 
Reported: 2004-08-13 03:52 EDT by Alexandre Oliva
Modified: 2007-11-30 17:07 EST (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2004-09-14 21:17:27 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


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

  None (edit)
Description Alexandre Oliva 2004-08-13 03:52:49 EDT
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 04:05:47 EDT
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 05:18:40 EDT
Regression testing on i686 completed.
Comment 4 Larry Troan 2004-09-14 21:17:27 EDT
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.