This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: PATCH for loop.c, SIGFPE with bad integer operands on host (linux-)ix86
- To: hp at bitrange dot com
- Subject: Re: PATCH for loop.c, SIGFPE with bad integer operands on host (linux-)ix86
- From: Andrew Haley <aph at pasanda dot cygnus dot co dot uk>
- Date: 5 Aug 1999 08:38:36 -0000
- CC: law at cygnus dot com, gcc-patches at gcc dot gnu dot org, krister dot walfridsson at precisebiometrics dot com, lars dot malmborg at precisebiometrics dot com
> Date: Wed, 4 Aug 1999 19:46:12 -0400 (EDT)
> From: Hans-Peter Nilsson <hp@bitrange.com>
>
> On 4 Aug 1999, Andrew Haley wrote:
> > > Date: Tue, 03 Aug 1999 18:09:31 -0600
> > > From: Jeffrey A Law <law@cygnus.com>
>
> > > The kernel trap handlers need to be fixed.
> >
> > Well, maybe. However, efficient Java implementation requires
> > language-specific handling of this case. Other programming languages
> > may also require handlers, for all I know. It would be a Bad Thing if
> > the kernel were to fail to send SIGFPE to a running Java application,
> > as we'd have to put a test around every divide instruction.
>
> You're in for a surprise if you actually expect this (SIGFPE for (int)
> 0x80000000 / -1) on (e.g.) linux-alpha or sun-sparc-solaris2*.
Weren't we talking about x86? Anyway, the Java language spec
unsurprisingly mandates SPARC behaviour; that is, division by zero
must throw an exception but division of INT_MIN by -1 must not. Java
also mandates the values which must be returned in the latter case, so
the SIGFPE handler performs a fixup.
I don't know if Ada requires an exception to be thrown for INT_MIN/-1.
Andrew.