nothrow changes
Jeffrey A Law
law@cygnus.com
Wed Mar 15 19:05:00 GMT 2000
All the nothrow work (as a whole) has broken nonlocal gotos.
Basically we are setting TREE_NOTHROW to a nonzero value on the function decl
for the nested function that has a computed goto.
When we later expand a call to that function we see TREE_NOTHROW is set
and set the EH region on the generated CALL_INSN to -1, so flow thinks
the call can not do a nonlocal goto or throw.
This results in flow computing an incorrect cfg and deleting code that
it believes is unreachable, but is actually reachable via the nonlocal
goto in the a nested function.
execute/920428-2.c shows this problem. I've tested it on ia32, ppc & the PA
all with the same basic results.
The mis-compiled function in question:
s(i)
{
if(i>0)
{
__label__ l1;
int f(int i)
{
if(i==2)
goto l1;
return 0;
}
return f(i);
l1:;
}
return 1;
}
We set TREE_NOTHROW on the function decl for "f". So when "s" calls "f"
we do not think that the call could do a non-local goto to nonlocal goto
receiver for label "l1" within "s".
So we delete the nonlocal goto receiver, which ultimately results in either
a core dump, an incorrect return value or other nasties.
I'm not entirely sure how you expected this stuff to work for nonlocal
gotos, so I haven't tried to fix it myself. I would appreciate it if you
would look into this problem.
Thanks,
jeff
More information about the Gcc
mailing list