[tree-ssa] Fix variables getting out of their scope

Jason Merrill jason@redhat.com
Mon Aug 11 15:25:00 GMT 2003


On Sun, 10 Aug 2003 17:13:20 -0400, Diego Novillo <dnovillo@redhat.com> wrote:

> I'm not sure this is a valid transformation.  I believe that it disrupts
> debugging information.  Jason?
>
> If not, then I would vote for moving *all* local declarations to the top
> BIND_EXPR and remove all BIND_EXPRs inside the function.  IIRC, I once
> suggested something along those lines but it didn't turn out to be a
> good idea because it would break debugging info.

It would mean having variables visible to the debugger outside their
scope.  This is probably not a major problem; it would hurt the most when
you have multiple block-local variables with the same name.  I don't know
how the debugger would deal with that, and this is likely to happen a fair
amount in the presence of inlining.

If we were to emit proper location list info for variables, the debugger
could be clever enough to decide that given multiple possible variables, it
should choose the one which is live at the current PC.

Jason



More information about the Gcc-patches mailing list