public inbox for linux-ia64@vger.kernel.org
 help / color / mirror / Atom feed
From: James E Wilson <wilson@tuliptree.org>
To: linux-ia64@vger.kernel.org
Subject: Re: Divide by zero works on ia64!!!
Date: Wed, 11 May 2005 18:36:13 +0000	[thread overview]
Message-ID: <1115836573.7882.46.camel@aretha.corp.specifixinc.com> (raw)
In-Reply-To: <1115652187.28663.4.camel@lyra.fc.hp.com>

On Mon, 2005-05-09 at 13:37, Gerald Pfeifer wrote:
> As Andreas pointed out, this code invokes undefined behavior.  Undefined
> here means that the result of an operation is not defined by the language
> standard, and 0 is a valid result when invoking an undefined operation.

It is undefined in C and C++, but what about other stricter languages
like Java and Ada?  I don't have language standards for either of them,
but I believe they both require exceptions here.  Then there is the
question of Fortran, which may also have something to say about this
issue.

Also, while C doesn't require an exception, it is expected behaviour for
a POSIX system, and other gcc ports make sure we get an exception.  The
MIPS gcc port for instance emits a conditional trap instruction, because
the MIPS integer divide instruction does not trap.  The IA-64 gcc port
could do likewise.

I'd call this an oversight, a quality of implementation problem for C, a
probable bug for Java and Ada, and worthy of a gcc bugzilla bug report
so that we don't forget about it.



      parent reply	other threads:[~2005-05-11 18:36 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-05-09 15:23 Divide by zero works on ia64!!! Khalid Aziz
2005-05-09 15:56 ` Andreas Schwab
2005-05-09 20:37 ` Gerald Pfeifer
2005-05-09 21:25 ` Khalid Aziz
2005-05-09 21:54 ` Gerald Pfeifer
2005-05-11 18:36 ` James E Wilson [this message]

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=1115836573.7882.46.camel@aretha.corp.specifixinc.com \
    --to=wilson@tuliptree.org \
    --cc=linux-ia64@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox