This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [tree-ssa] Implement non-call exceptions


Richard Henderson writes:
 > 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.

Alright.

 > > I guess it depends on the language.  What language throws exceptions
 > > on floating-point exceptions?  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.

Hmm.  Why do we need to treat instructions that can fault, but cannot
throw, in a special way?  All we can do right now with such faults in
C or C++ is call a signal handler, and that handler cannot return but
must longjmp().

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

Okay, but it seems to me reasonable that you'd have to tell the
compiler what you were doing.  In other words, I don't want Java to
pay the price for a theoretical future direction for C++...

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

I see.

Andrew.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]