This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [tree-ssa] Implement non-call exceptions
On Thu, Dec 04, 2003 at 11:00:48AM +0000, Andrew Haley wrote:
> Maybe I'll have a look at the mainline code to find out why it behaves
> differently.
That would be good, because IIRC division is handled specially
in this case by optabs.c.
> I guess it depends on the language. What language throws exceptions
> on floating-point execptions? Ada? Perhaps it should be a langhook.
It's more than throwing. Look at the rtl may_trap_p. It is true
for anything that could *fault*. It's probably a mistake to have
a function whose name implies the same test but behaves differently.
At present we don't have any tree-level optimizations that move
code places that they wouldn't have been executed before, but that
could change in the future.
Anyway, in theory one could use -fnon-call-exceptions in C++ and
throw floating point exceptions yourself, assuming you installed
a handler similar to what libjava implements. I would expect it
to work.
A language hook might be a reasonable idea, but that would have
to go into tree_could_throw_p, rather than tree_could_trap_p.
r~