* nothrow changes
@ 2000-03-15 19:05 Jeffrey A Law
2000-03-15 23:35 ` Patch " Jason Merrill
0 siblings, 1 reply; 3+ messages in thread
From: Jeffrey A Law @ 2000-03-15 19:05 UTC (permalink / raw)
To: jason; +Cc: gcc
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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Patch Re: nothrow changes
2000-03-15 19:05 nothrow changes Jeffrey A Law
@ 2000-03-15 23:35 ` Jason Merrill
2000-03-16 1:48 ` Jeffrey A Law
0 siblings, 1 reply; 3+ messages in thread
From: Jason Merrill @ 2000-03-15 23:35 UTC (permalink / raw)
To: law; +Cc: gcc
>>>>> Jeffrey A Law <law@cygnus.com> writes:
> All the nothrow work (as a whole) has broken nonlocal gotos.
> 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.
Oops.
2000-03-15 Jason Merrill <jason@casey.cygnus.com>
* calls.c (emit_call_1): Nothrow functions can still have nonlocal
gotos.
Index: calls.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/calls.c,v
retrieving revision 1.91
diff -c -p -r1.91 calls.c
*** calls.c 2000/03/09 20:34:51 1.91
--- calls.c 2000/03/16 07:31:51
*************** emit_call_1 (funexp, fndecl, funtype, st
*** 495,501 ****
/* If this call can't throw, attach a REG_EH_REGION reg note to that
effect. */
if (nothrow)
! REG_NOTES (call_insn) = gen_rtx_EXPR_LIST (REG_EH_REGION, GEN_INT (-1),
REG_NOTES (call_insn));
/* Restore this now, so that we do defer pops for this call's args
--- 495,501 ----
/* If this call can't throw, attach a REG_EH_REGION reg note to that
effect. */
if (nothrow)
! REG_NOTES (call_insn) = gen_rtx_EXPR_LIST (REG_EH_REGION, const0_rtx,
REG_NOTES (call_insn));
/* Restore this now, so that we do defer pops for this call's args
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Patch Re: nothrow changes
2000-03-15 23:35 ` Patch " Jason Merrill
@ 2000-03-16 1:48 ` Jeffrey A Law
0 siblings, 0 replies; 3+ messages in thread
From: Jeffrey A Law @ 2000-03-16 1:48 UTC (permalink / raw)
To: Jason Merrill; +Cc: gcc
In message < u91z5bjrk5.fsf@yorick.cygnus.com >you write:
> Oops.
>
> 2000-03-15 Jason Merrill <jason@casey.cygnus.com>
>
> * calls.c (emit_call_1): Nothrow functions can still have nonlocal
> gotos.
Thanks. I was looking completely elsewhere and would have mucked it up
badly had I tried to fix this. Thanks again!
jeff
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2000-03-16 1:48 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-03-15 19:05 nothrow changes Jeffrey A Law
2000-03-15 23:35 ` Patch " Jason Merrill
2000-03-16 1:48 ` Jeffrey A Law
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).