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

JIT Bug - creates invalid code

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 1.2.2
    • 1.1.7
    • vm-legacy
    • 1.2.2
    • x86
    • windows_nt



      Name: diC59631 Date: 10/07/98


      The problem is not fixed !!!
      I gave it to you on 1998/jul/05, for JDK 1.1.6,
      and it still gives bad results.

      please run this code with and without "-nojit",
      and see that you get different results.

      I took me a long time to isolate the problem
      for you, and you can realy look into it.

      bye,
        Doron.




      class Bug {

          public static void main(String[] args) {
              char[] text = { 'T', 'h', 'i', 's', ' ', 'i', 's', ' ', 'a', ' ' };
              int r = chk(text, 0, text.length);
              if (r == 4) {
                  System.out.println("This is the correct result!");
              } else {
                  System.out.println("Invalid result: " + r + ". The correct result is 4.");
              }
          }

          private static int chk(char[] text, int startOffset, int endOffset) {
              boolean specialAsciiCharsExist = false;
              do {
                  char c = text[startOffset];
                  if (isSpecialAscii(c)) {
                      specialAsciiCharsExist = true;
                  }
                  text[startOffset++] = c;
              } while (startOffset < endOffset && !isSpace(text[startOffset]));

              return startOffset;
          }

          private static boolean isSpace(char c) {
              return c == ' ';
          }

          private static boolean isSpecialAscii(char c) {
              return false;
          }

      }
      (Review ID: 40135)
      ======================================================================

            dviswanasunw Deepa Viswanathan (Inactive)
            dindrigo Daniel Indrigo (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: