public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* 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

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).