public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
From: Hans_Boehm@hp.com
To: gcc-gnats@gcc.gnu.org
Cc: tromey@redhat.com
Subject: optimization/6411: Division by zero may not raise exception on Linux/X86
Date: Mon, 22 Apr 2002 15:36:00 -0000	[thread overview]
Message-ID: <20020422223026.19739.qmail@sources.redhat.com> (raw)


>Number:         6411
>Category:       optimization
>Synopsis:       Division by zero may not raise exception on Linux/X86
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Apr 22 15:36:01 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     Hans_Boehm@hp.com
>Release:        Gcc pre3.1
>Organization:
>Environment:
Linux/X86
>Description:
A division by zero can be eliminated by the gcc optimizer.
This is incorrect for Java code, since it should still 
raise an exception.  This causes SPECjbb, for example,
to fail with gcj on X86.

This doesn't seem to be an issue on IA64, probably because
a divide routine is always called?
>How-To-Repeat:
[hboehm@hoh ~/java]$ cat divtest2.java
public class divtest2 {
    public static void main(String argv[])
    {
	int a = -10;
	int b = 0;
	try {
	  a = a/b;
	  System.out.println("Failed to throw it");
	} catch (java.lang.Exception x) {
	  System.out.println("Caught it");
	}
    }
}
[hboehm@hoh ~/java]$ gcj divtest2.java --main=divtest2
[hboehm@hoh ~/java]$ ./a.out
Caught it
[hboehm@hoh ~/java]$ gcj -O2 divtest2.java --main=divtest2
[hboehm@hoh ~/java]$ ./a.out
Failed to throw it
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:


             reply	other threads:[~2002-04-22 22:36 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-04-22 15:36 Hans_Boehm [this message]
2002-10-06 21:36 Andrew Pinski
2002-10-07  0:15 rth

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=20020422223026.19739.qmail@sources.redhat.com \
    --to=hans_boehm@hp.com \
    --cc=gcc-gnats@gcc.gnu.org \
    --cc=tromey@redhat.com \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).