This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Enhanced nested functions lowering pass
On Mar 19, 2006, at 2:20 AM, Eric Botcazou wrote:
Actually this testcase is really the same as PR 24169 :).
No, it isn't, the *whole* nonlocal frame structure always escapes.
The problem is the same.
Just change that testcase instead to:
struct g
{
char i, j;
};
static void f(struct g *a)
{
a->j = 1;
}
void h(void)
{
struct g k = {2, 2};
f(&k);
if (k.i != 2)
link_error ();
}
-----
Now there is no difference between the nested version and this non
nested
version but the problem is the same. In fact this is just an example
of IPA
aliasing combined and IPA call clobbering can help.
if we change your (nested) example to:
int foo(void)
{
int a = 0;
int b = 0;
int c;
void bar1 (void)
{
a = 1;
}
void bar2 (void)
{
b = 1;
}
a = a + 1;
bar2 ();
c = a + b;
bar1 ();
return c + b;
}
Your enhancement of nest lowering does nothing to improve
this case which I would not doubt is more common in general in both
Ada and Fortran (and maybe even Pascal) than you unused nested function
example.
-- Pinski