Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4028670

jvm abort on integer division overflow on Solaris x86

    XMLWordPrintable

    Details

    • Subcomponent:
    • CPU:
      sparc
    • OS:
      solaris_2.4

      Description



      Name: swC45995 Date: 01/29/97

      jvm aborts when integer division results in overflow though
      JLS says:

      ... if the dividend is the negative integer of largest possible magnitude
      for its type, and the divisor is -1, then integer overflow occurs and the
      result is equal to the dividend. Despite the overflow, no exception is
      thrown in this case. (#15.16.2)

      Nevertheless execution of the following test

      import java.io.PrintStream;

      public class test
      {
      public static void main(String args[]) {
      int i = 0x80000000;

      if (i / - 1 != -2147483648)
      System.out.println("fail");
      else
      System.out.println("pass");
      }

      aborts instead of producing correct output which is:

      pass

      ======================================================================


      NOTE: This is Solaris x86 only. The test passes on Win32 and Solaris/SPARC.

      timothy.lindholm@Eng 1997-01-29

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              tlindholsunw Timothy Lindholm (Inactive)
              Reporter:
              wensunw Wen Wen (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: