From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23000 invoked by alias); 22 Apr 2002 22:36:02 -0000 Mailing-List: contact gcc-prs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-prs-owner@gcc.gnu.org Received: (qmail 22965 invoked by uid 71); 22 Apr 2002 22:36:01 -0000 Resent-Date: 22 Apr 2002 22:36:01 -0000 Resent-Message-ID: <20020422223601.22964.qmail@sources.redhat.com> Resent-From: gcc-gnats@gcc.gnu.org (GNATS Filer) Resent-To: nobody@gcc.gnu.org Resent-Cc: gcc-prs@gcc.gnu.org, gcc-bugs@gcc.gnu.org, tromey@redhat.com Resent-Reply-To: gcc-gnats@gcc.gnu.org, Hans_Boehm@hp.com Received:(qmail 19740 invoked by uid 61); 22 Apr 2002 22:30:26 -0000 Message-Id:<20020422223026.19739.qmail@sources.redhat.com> Date: Mon, 22 Apr 2002 15:36:00 -0000 From: Hans_Boehm@hp.com Reply-To: Hans_Boehm@hp.com To: gcc-gnats@gcc.gnu.org Cc: tromey@redhat.com X-Send-Pr-Version:gnatsweb-2.9.3 (1.1.1.1.2.31) X-GNATS-Notify:tromey@redhat.com Subject: optimization/6411: Division by zero may not raise exception on Linux/X86 X-SW-Source: 2002-04/txt/msg01136.txt.bz2 List-Id: >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: