class Hello { public static int foo() { return 1; } public static void x(int bar) { int [1d] local a = new int [1 : 10 : 2]; int [2d] local b = new int [2 : 5, 3 : 4]; int i = foo(); /* Working */ for (int p = 1; p < 10; p += 2) a[p] = 3; for (int p = 1; p <= 5; p += 2) a[[p] + [2]] = 3; for (int p = 5; p <= 9; p += 2) a[[p] - [4]] = 3; for (int p = 2; p <= 2; ++p) { a[[p] + [1]] = 3; } /* Broken */ if (bar == 0) for (int p = 1; p <= 3; ++p) { a[[p] + [1]] = 3; } if (bar == 1) for (int p = 5; p <= 7; p += 2) { a[[p] + [i]] = 3; } if (bar == 2) for (int p = 5; p <= 7; p += 2) { a[[p] + [1]] = 3; } if (bar == 3) for (int p = 2; p <= 3; p++) { a[[p] + [1]] = 3; } } public static void y(int bar) { int [2d] local a = new int [2 : 52 : 4 , 3 : 9 : 3]; int [2d] local b = new int [10 : 22 : 2, 3 : 19 : 6]; int [2d] local c = b.restrict(a.domain()); int i = foo(); /* Working */ for (int p = 2; p <= 52; p += 4) { a[p, 6] = a[p, 3]; } /* Broken */ if (bar == 0) /* bogus due to restriction */ for (int p = 10; p < 21; p += 2) c[p, 3] = 0; if (bar == 1) /* all points off stride */ for (int p = 3; p < 7; p += 3) a[[5, p] + [1, 1]] = 3; if (bar == 2) /* all points off stride */ for (int p = 5; p <= 7; p += 2) a[2 * p + i, 3] = 99; if (bar == 3) /* first ok, rest bogus */ foreach (p in [2 : 3, 9 : 13, 1 : 3]) a[p[1] + 4, p[3] + 5] = 33; } public static void main(String[] args) { try { if (args.length == 0) x(-1); else switch (Integer.parseInt(args[0])) { default: case 0: x(0); break; case 1: x(1); break; case 2: x(2); break; case 3: x(3); break; case 4: y(0); break; case 5: y(1); break; case 6: y(2); break; case 7: y(3); break; } } catch (Throwable x) {} System.out.println("Hello world!"); } }