From: Teemu Torma <tot@trema.com>
To: egcs@cygnus.com
Subject: Flow analysis confused by exception handling
Date: Tue, 02 Dec 1997 01:47:00 -0000 [thread overview]
Message-ID: <199712020947.KAA05490@lev.labs.trema.com> (raw)
The problem I sent few days ago about register being clobbered
in sparc while throwing seems to be actually flow analysis problem.
In the following code, the initial assignment to `i' gets deleted
because the next instruction also assigns it.
The rtl dump after the second cse looks like:
(insn 11 8 13 (set (reg/v:SI 105)
(const_int 0)) 111 {*movsi_insn} (nil)
(expr_list:REG_EQUAL (const_int 0)
(nil)))
(note 13 11 15 13 NOTE_INSN_EH_REGION_BEG)
(note 15 13 17 "" NOTE_INSN_DELETED)
(note 17 15 19 "" NOTE_INSN_DELETED)
(call_insn 19 17 21 (parallel[
(set (reg:SI 8 %o0)
(call (mem:SI (symbol_ref:SI ("bar__Fv")))
(const_int 0)))
(clobber (reg:SI 15 %o7))
] ) -1 (nil)
(nil)
(nil))
But after the flow analysis, the assignment to zero is gone:
(note 8 7 11 "" NOTE_INSN_DELETED)
;; Start of basic block 0, registers live: 14 [%sp] 30 [%fp] 31 [%i7]
(note 11 8 13 "" NOTE_INSN_DELETED)
(note 13 11 15 13 NOTE_INSN_EH_REGION_BEG)
(note 15 13 17 "" NOTE_INSN_DELETED)
(note 17 15 19 "" NOTE_INSN_DELETED)
(call_insn 19 17 21 (parallel[
(set (reg:SI 8 %o0)
(call (mem:SI (symbol_ref:SI ("bar__Fv")))
(const_int 0)))
(clobber (reg:SI 15 %o7))
] ) -1 (nil)
(expr_list:REG_UNUSED (reg:SI 15 %o7)
(nil))
(nil))
This would be right if bar wouldn't throw anything, but it is
clearly wrong because insn 19 does not actually assign anything.
Teemu
---------------------------------------------------------------------------
#include <stdio.h>
int bar ()
{
throw 100;
}
main ()
{
int i = 0; // this gets deleted after flow analysis
try
{
i = bar ();
}
catch (...)
{
}
printf ("i = %d\n", i);
return i;
}
---------------------------------------------------------------------------
next reply other threads:[~1997-12-02 1:47 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
1997-12-02 1:47 Teemu Torma [this message]
[not found] <199712020947.KAA05490.cygnus.egcs@lev.labs.trema.com>
1997-12-02 2:25 ` Jason Merrill
1997-12-02 13:14 ` Joern Rennecke
1997-12-02 16:29 ` Jeffrey A Law
1997-12-03 4:36 meissner
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=199712020947.KAA05490@lev.labs.trema.com \
--to=tot@trema.com \
--cc=egcs@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).