public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jeffrey A Law <law@cygnus.com>
To: jason@cygnus.com
Cc: gcc@gcc.gnu.org
Subject: nothrow changes
Date: Wed, 15 Mar 2000 19:05:00 -0000	[thread overview]
Message-ID: <15383.953175541@upchuck> (raw)

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





             reply	other threads:[~2000-03-15 19:05 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-03-15 19:05 Jeffrey A Law [this message]
2000-03-15 23:35 ` Patch " Jason Merrill
2000-03-16  1:48   ` Jeffrey A Law

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=15383.953175541@upchuck \
    --to=law@cygnus.com \
    --cc=gcc@gcc.gnu.org \
    --cc=jason@cygnus.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).