Bug 37726

Summary: [4.4 Regression] Even at -O0 -g debuginfo for vars mentioned in nested fns is not emitted
Product: gcc Reporter: Jakub Jelinek <jakub>
Component: debugAssignee: Jakub Jelinek <jakub>
Status: RESOLVED FIXED    
Severity: normal CC: gcc-bugs
Priority: P3    
Version: 4.4.0   
Target Milestone: 4.4.0   
Host: Target:
Build: Known to work:
Known to fail: Last reconfirmed: 2008-10-03 13:29:37

Description Jakub Jelinek 2008-10-03 13:28:17 UTC
int foo (int parm)
{
  int var = 0;
  int bar (void)
  {
    return parm + var;
  }
  parm++;
  var++;
  return bar ();
}

int
main (void)
{
  return foo (4) - 6;
}

at -O0 -g this was perfectly debuggable in 4.3, but doesn't know anything about parm or var, neither in the outer nor inner function.
Comment 1 Jakub Jelinek 2008-10-03 18:57:01 UTC
Subject: Bug 37726

Author: jakub
Date: Fri Oct  3 18:55:39 2008
New Revision: 140857

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=140857
Log:
	PR debug/37726
	* gimplify.c (declare_vars): Use gimple_bind_block instead of
	gimple_block.

	* gcc.dg/debug/dwarf2/pr37726.c: New test.

Added:
    trunk/gcc/testsuite/gcc.dg/debug/dwarf2/pr37726.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/gimplify.c
    trunk/gcc/testsuite/ChangeLog

Comment 2 Jakub Jelinek 2008-10-03 19:35:21 UTC
Fixed.
Comment 3 Andrew Pinski 2008-10-07 20:04:23 UTC
This test does not work for darwin for some reason, I have not looked why though, I bet it is due to the way dwarf2 is outputted there.