[tree-ssa] Fix variables getting out of their scope
Zdenek Dvorak
rakdver@atrey.karlin.mff.cuni.cz
Wed Aug 20 22:33:00 GMT 2003
Hello,
> >>I have to do something like this hack (which only works if there are
> >>other statements in the block you are moving to), methinks:
> >
> >well, almost. Given that boundary of BIND_EXPR may be in the middle of
> >a basic block, this does not always have to be exactly what you want.
> >Not that I would be aware of an easy solution.
>
> Richard Henderson suggested we simply change the way we process the
> VAR_DECL's so that we walk the bind_vars before walking anything. That
> way, we don't have to move things around.
seems like an interesting idea; a few problems:
1) optimizations may really change a scope of variables:
{
int k;
{
int i = ...
k = i;
}
{
int bla = ...;
}
{
int j = k;
...
}
}
copy propagation may replace set to j with i, thus moving it out of its
scope. Given that we may (??? not really sure whether we do it) assign
the same stack slot to i, j and bla, this would cause a misscompilation.
2) That cursed extension:
{
int z = ...;
{
int array[z];
}
}
Not really sure whether the process you describe is able to handle this.
But we probably should lower this anyway.
Zdenek
More information about the Gcc-patches
mailing list