All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Daney <ddaney@avtrex.com>
To: gcc@gcc.gnu.org, linux-mips@linux-mips.org
Cc: java@gcc.gnu.org
Subject: [RFC] MIPS division by zero and libgcj...
Date: Thu, 10 Jun 2004 12:12:27 -0700	[thread overview]
Message-ID: <40C8B29B.3090501@avtrex.com> (raw)

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.

Gcj when configured for this platform uses the -f-use-divide-subroutine 
option, causing it to never generate inline division instructions (nor 
the accompanying break 7), but instead call a runtime function that 
properly handles throwing ArithmeticException.

Q1:  Is this behavior (use of break 7 and SIGTRAP) part of some ABI 
specification?  I'll admit a bit of ignorance in this area.

Q2: Does anyone see any reason that libgcj should not be configured to 
handle the SIGTRAP and throw the ArithmeticException from the signal 
handler (similar to what is done on i386).

Q3: Will using SIGTRAP in this manner make debugging programs that 
divide things by zero very difficult to debug under gdb?

Q4: I appears that on the i386, a divide overflow causes SIGFPE.  Why 
doesn't the mips-linux kernel sent SIGFPE on "break 7"

Q5: prims.cc in libgcj implies that we should be handling SIGFPE to do 
all this.  If I make these changes, won't it be a little confusing that 
all references to SIGFPE are really SIGTRAP?


David Daney

             reply	other threads:[~2004-06-10 19:14 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-06-10 19:12 David Daney [this message]
2004-06-10 19:31 ` [RFC] MIPS division by zero and libgcj Andrew Haley
2004-06-10 19:39   ` Andrew Haley
2004-06-10 19:48   ` David Daney
2004-06-10 19:58     ` Andrew Haley
2004-06-10 20:31       ` David Daney
2004-06-10 20:27   ` Ralf Baechle
2004-06-11 14:01 ` Maciej W. Rozycki
2004-06-11 15:34   ` David Daney
2004-06-11 15:39     ` Maciej W. Rozycki

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=40C8B29B.3090501@avtrex.com \
    --to=ddaney@avtrex.com \
    --cc=gcc@gcc.gnu.org \
    --cc=java@gcc.gnu.org \
    --cc=linux-mips@linux-mips.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.