Bug 129730 (IT#43309) - g++ emits incorrect debug information
Summary: g++ emits incorrect debug information
Keywords:
Status: CLOSED ERRATA
Alias: IT#43309
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:
TreeView+ depends on / blocked
 
Reported: 2004-08-12 09:05 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-02 02:31:29 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
back-port of patch that fixed the bug in 3.4 (3.92 KB, patch)
2004-08-12 09:16 UTC, Alexandre Oliva
no flags Details | Diff
Reverts a patchlet obsoleted by the back-port, re-enabling NVR (1.02 KB, patch)
2004-08-13 04:57 UTC, Alexandre Oliva
no flags Details | Diff


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2004:442 0 normal SHIPPED_LIVE Updated gcc packages 2004-09-01 04:00:00 UTC

Description Alexandre Oliva 2004-08-12 09:05:11 UTC
Given a testcase like this (reduced from a huge testcase submitted by
a customer):

struct foo { ~foo() {} };
int main(int i, char *p[]) {
 int late = i;
  if (late) { foo unused; }
  switch (i) { default: foo bar; break; }
  foo late_scope;
}

Debug information for the variable late is there, but in a lexical
block that starts close to the end of the function, so you can't see
the variable in gdb unless you are at the point where late_scope is
already in scope.

Comment 2 Jakub Jelinek 2004-08-12 09:09:04 UTC
With -g -O0 or with -O1 and higher?
With optimization on, that should be well expected.

Comment 3 Alexandre Oliva 2004-08-12 09:16:36 UTC
Created attachment 102642 [details]
back-port of patch that fixed the bug in 3.4

This is a trivial back-port of
http://gcc.gnu.org/ml/gcc-patches/2002-12/msg00862.html

I still haven't run it through the regression tester, but I've verified that it
fixes the debug information produced for the simplified testcase.

Comment 4 Alexandre Oliva 2004-08-12 09:18:03 UTC
g++ -g -O0.

Comment 6 Alexandre Oliva 2004-08-13 04:57:50 UTC
Created attachment 102686 [details]
Reverts a patchlet obsoleted by the back-port, re-enabling NVR

Turns out Jakub noticed the patch introduced a regression in the named return
value optimization.  That's because 3.2 and 3.3 have a patch to work around the
very absence of the additional artificial block, as discussed in the thread
starting at http://gcc.gnu.org/ml/gcc-patches/2003-03/msg01559.html, with the
fix for http://gcc.gnu.org/PR9993.

After back-porting the patch that introduced the additional scope, we have to
revert that bit of the patch.  This is what the attached patch does.

Comment 7 John Flanagan 2004-09-02 02:31:29 UTC
An errata has been issued which should help the problem 
described in this bug report. This report is therefore being 
closed with a resolution of ERRATA. For more information
on the solution and/or where to find the updated files, 
please follow the link below. You may reopen this bug report 
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2004-442.html



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