Bug 129730 - (IT#43309) g++ emits incorrect debug information
g++ emits incorrect debug information
Product: Red Hat Enterprise Linux 3
Classification: Red Hat
Component: gcc (Show other bugs)
All Linux
medium Severity medium
: ---
: ---
Assigned To: Jakub Jelinek
Depends On:
  Show dependency treegraph
Reported: 2004-08-12 05:05 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:
Last Closed: 2004-09-01 22:31:29 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

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

  None (edit)
Description Alexandre Oliva 2004-08-12 05:05:11 EDT
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 05:09:04 EDT
With -g -O0 or with -O1 and higher?
With optimization on, that should be well expected.
Comment 3 Alexandre Oliva 2004-08-12 05:16:36 EDT
Created attachment 102642 [details]
back-port of patch that fixed the bug in 3.4

This is a trivial back-port of

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 05:18:03 EDT
g++ -g -O0.
Comment 6 Alexandre Oliva 2004-08-13 00:57:50 EDT
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-01 22:31:29 EDT
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.


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