This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
[tree-ssa] Handling of variable scopes?
Hello,
it is probably a known issue, but anyway. During my playing with
tree-ssa branch, I encountered the following problem. Consider
this testcase:
#include <stdio.h>
int main(void)
{
int k;
goto bla;
st:;
printf("%d\n", k);
return 0;
bla:;
{
int j = foo ();
k = j;
}
goto st;
}
In dominator optimization, a set to k is copy propagated, thus we obtain
int main(void)
{
goto bla;
st:;
printf("%d\n", j);
return 0;
bla:;
{
int j = foo ();
}
goto st;
}
j is now out of its scope, which is plainly wrong and causes ICE when
the variable is referenced the first time (I have tried to persuade gcc
to actually misscompile something this way, but I have failed; but I
don't much doubt that it is possible).
Zdenek