This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
Re: [RFC] MIPS division by zero and libgcj...
- From: "Maciej W. Rozycki" <macro at ds2 dot pg dot gda dot pl>
- To: David Daney <ddaney at avtrex dot com>
- Cc: gcc at gcc dot gnu dot org, linux-mips at linux-mips dot org, java at gcc dot gnu dot org
- Date: Fri, 11 Jun 2004 16:01:42 +0200 (CEST)
- Subject: Re: [RFC] MIPS division by zero and libgcj...
- Organization: Technical University of Gdansk
- References: <40C8B29B.3090501@avtrex.com>
On Thu, 10 Jun 2004, David Daney wrote:
> It appears that gcc configured for mipsel-linux will execute a "break 7"
> instruction on integer division by zero.
>
> This causes the kernel (I am using 2.4.25) to send SIGTRAP.
It looks like you have a problem in your configuration. A "break 7"
(or "teq <divisor>,$zero,7" -- but that's currently implemented in gas
only) is indeed emitted and exectuted in the case of division by zero, but
Linux has the ability to recognize this special break code and sends
SIGFPE instead. There are actually two special codes defined, the other
being "6" for an overflow. Both are handled by Linux, with si_code in
struct siginfo being set to FPE_INTDIV or FPE_INTOVF, respectively. You
can handle this appropriately in a signal handler.
--
+ Maciej W. Rozycki, Technical University of Gdansk, Poland +
+--------------------------------------------------------------+
+ e-mail: macro@ds2.pg.gda.pl, PGP key available +