Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[upstream]art-test 407-arrays c2 jit run fail #75

Open
sendaoYan opened this issue Jun 28, 2023 · 3 comments
Open

[upstream]art-test 407-arrays c2 jit run fail #75

sendaoYan opened this issue Jun 28, 2023 · 3 comments

Comments

@sendaoYan
Copy link
Collaborator

image

TestCase.java.txt
Main.java.txt

@sendaoYan
Copy link
Collaborator Author

裁剪结果为:-Xcomp选项运行,导致数组越界异常信息丢失:

image

class Main {
    public static void main(String[] a) {
        b(new boolean[2], 2);
        b(new boolean[2], 4);
        b(new boolean[2], -1);
        b(new boolean[2], Integer.MIN_VALUE);
    }

    static void b(boolean[] array, int i) {
        ArrayIndexOutOfBoundsException d = null;
        try {
            f(array, i);
        } catch (ArrayIndexOutOfBoundsException e) {
            d = e;
        }
        assertTrue(d.toString().contains(Integer.toString(i)), d.toString());
        try {
            h(array, i);
        } catch (ArrayIndexOutOfBoundsException e) {
        }
    }

    static void f(boolean[] array, int c) {
        boolean i = array[c];
    }

    static void h(boolean[] array, int c) {
    }

    static void assertTrue(boolean b, String string) {
        System.out.println(string);
        if (!b)
            throw new AssertionError();
    }
}

creduce.sh.txt

@sendaoYan
Copy link
Collaborator Author

社区主干也有问题

image

@y1yang0
Copy link
Collaborator

y1yang0 commented Jul 7, 2023

Further reduction, filed as https://bugs.openjdk.org/browse/JDK-8311623

class Test {
  public static void main(String[] a) {
      b(new boolean[2], 2);
      b(new boolean[2], 4);
      b(new boolean[2], -1);
      b(new boolean[2], 5);
  }

  static void b(boolean[] array, int i) {
      ArrayIndexOutOfBoundsException d = null;
      try {
          f(array, i);
      } catch (ArrayIndexOutOfBoundsException e) {
          e.printStackTrace();
          d = e;
      }
      assertTrue(d.toString().contains(Integer.toString(i)), d.toString());
  }

  static void f(boolean[] array, int c) {
      boolean i = array[c];
  }

  static void assertTrue(boolean b, String string) {}
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants