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

PhaseStringOpts::int_stringSize doesn't handle min_jint correctly

XMLWordPrintable

    • b25
    • x86_64
    • linux_ubuntu, windows_10
    • Verified

        Problem: Calling StringIndexOutOfBoundsException(Integer.MIN_VALUE) and checking the "toString()" return value eventually (after 10k+ tries) returns an error message indicating the value passed in was "-2".

        Correct toString() return value: "java.lang.StringIndexOutOfBoundsException: String index out of range: -2147483648"

        Incorrect toString() return value:
        "java.lang.StringIndexOutOfBoundsException: String index out of range: -2"

        This error does not occur on JDK8, but does occur in 4 out of 5 complete runs on JDK11, and all runs on JDK16.

        On JDK11 we see the failure once between 10k and 20k, and on JDK16 and 17 we see the failure once between 10k and 20k, with continuous occurrences starting around the 30k-40k mark.

        (A minimal testcase will be attached. I limited the failures to 20 to avoid swamping. Feel free to edit as needed.)

        Since this bug doesn't occur when the jit is disabled, and the occurrences only start around the 10k mark, I'm assuming this is a JIT defect. Will ask the community if anyone with JIT skills could take a look.

              neliasso Nils Eliasson (Inactive)
              afarley Adam Farley
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

                Created:
                Updated:
                Resolved: