On Mon, Aug 06, 2012 at 01:40:57PM -0400, Frank Ch. Eigler wrote:
> Senthil Kumar Selvaraj <senthil_kumar.selva...@atmel.com> writes:
> 
> > [...]
> > The following program, when compiled with -O0 -g3 (x86_64 target, but
> > doesn't seem to matter), shows wrong values for p (function parameter)
> > when debugging. [...]
> 
> This sounds like <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51358>.
> 

I guess that's a different issue - that bug talks about debug info for
formal parameters being invalid before they are pushed on the stack. In
the case I described, it stays wrong for the entire body of the
function. 

The core of the problem appears to be that a formal parameter
that is not read from but written to, is allocated space on the stack twice - 
once when expand_used_vars runs, and once when expand_function_start
runs. The debug information generated for the formal parameter only
points to the space allocated by the former, and thus does not reflect
writes to the variable that occur on the space allocated by the
latter.

Regards
Senthil

Reply via email to