Skip to content

Running the attached minimal Java program under an OpenJ9 fastdebug build with -Xjit:count=200,optLevel=scorching causes a JIT assertion failure during compilation of Test. The same program runs normally (prints “PASS”) with default JIT settings. #23266

@SunParis

Description

@SunParis

Environment

  • JVM: OpenJ9 fastdebug build (3afb05926272c09b5d7450134ed147bfe8841122, 17.0.18-internal+0-adhoc.syc.jdk17u-j9-master-7040b06a21)
  • OS: Linux 6.18.6, x86_64
  • Build GCC: 9.5
  • Build type: fastdebug

Key assertion and component

- Compile level: scorching
- Options: -Xjit:count=200,optLevel=scorching -Xshareclasses:none

Steps to reproduce

  1. Save the source code below as Test.java. And also download the attached
    FuzzerUtils.java file to the same directory.

  2. Compile: javac Test.java.

  3. Run with OpenJ9 fastdebug build:

    • Failing run:
     <jdk>/bin/java -Xjit:count=200,optLevel=scorching -Xshareclasses:none Test
    
    • Control run (works):
     <jdk>/bin/java -Xshareclasses:none Test
    

Expected result

The program should run without JIT assertions or crashes and print “PASS”.

Actual result

With -Xjit:count=200,optLevel=scorching, the JIT hits an assertion failure.

javacore.20260127.195912.477018.0002.txt

A subsequent run without the scorching JIT option prints just:

PASS

Source code


class Cls2 {
    public static final int N = 128;
    public static volatile long instanceCount = -1L;
    public static java.lang.String strFld = "three";
    public static int iArrFld[] = new int[Cls2.N];
    public java.lang.Object OArrFld[] = new java.lang.Object[14];
    public float fArrFld[][] = new float[Cls2.N][Cls2.N];
    public short sArrFld[] = new short[Cls2.N];
    static {
        FuzzerUtils.init(Cls2.iArrFld, 189);
    }
    public static long Cls2_check_sum = 0;
    public static long vMeth1_check_sum = 0;

    public static void vMeth1(double d1, float f1, int i9) {
        vMeth1_check_sum += i9;
        return;
    }

    public Cls2() {
        Cls2.instanceCount++;
        long meth_res = 0;
        float f6 = 88.926F, f7 = 0.846F;
        int i35 = 118, i36 = 151, i37 = -54162, i38 = 217,
            i39 = 203, i40 = -252, i41 = 12, i42 = -10,
            i43 = -63277, i44 = -8, i45 = 10;
        long l2 = -51841L;
        boolean b3 = true;
        double d5 = -1.85485, d6 = 31.73819;
        java.lang.String str2 = "three";
        java.lang.String str3 = "four";
        byte by3 = 8;
        byte byArr1[] = new byte[Cls2.N];
        Cls1 O16 = new Cls1();
        Cls O17 = new Cls();
        FuzzerUtils.init(byArr1, ((byte) (-80)));
        Cls2.strFld += Cls2.strFld;
        Test.fMeth();
        f6 += ((float) (Cls1.iFld));
        for (f7 = ((float) (104)); f7 > 2; f7 -= 2) {
            for (l2 = ((long) (30)); l2 > 1; l2--) {
                i37 = 1;
                do {
                    switch (((i36 >>> 1) % 1) + 4) {
                        case 4 :
                            switch (((int) ((f7 % 1) + 54))) {
                                case 54 :
                                    byArr1[i37] = ((byte) (i37));
                            }
                            O16 = new Cls1();
                            i36 -= i36;
                            break;
                    }
                } while ((++i37) < 2 );
            }
        }
        meth_res =
            java.lang.Float.floatToIntBits(f6) + java.lang.Float.floatToIntBits(f7) + i35 +
            l2 + i36 + i37 + i38 + i39 + i40 + i41 + i42 + (b3 ? 1 : 0) + 
            java.lang.Double.doubleToLongBits(d5) + str2.length() + java.lang.Double.doubleToLongBits(d6) + 
            i43 + i44 + str3.length() + i45 + by3 + FuzzerUtils.checkSum(byArr1);
        Cls2.Cls2_check_sum += meth_res;
        return;
    }

}

public class Test {
    public static final int N = 128;
    public static long instanceCount = 31938L;
    public static short sFld = 1632;
    public static java.lang.String strFld1 = "one";
    public static int iFld1 = 9774;
    public static byte byFld = 64;
    public float fFld1 = 0.52F;
    public int iFld2 = 235;
    public static double dFld = -38.64046;
    public boolean bFld = true;
    public static volatile long lFld = -4778325873336617161L;
    public static volatile int iArrFld1[] = new int[Test.N];
    public long lArrFld[] = new long[Test.N];
    public static int iArrFld2[][] = new int[Test.N][Test.N];
    public java.lang.String strArrFld[][] = new java.lang.String[Test.N][Test.N];
    static {
        FuzzerUtils.init(Test.iArrFld1, 54);
        FuzzerUtils.init(Test.iArrFld2, -233);
    }
    public static long vMeth_check_sum = 0;
    public static long fMeth_check_sum = 0;

    public static float fMeth() {
        long meth_res = 0;
        int i2 = 2;
        int i3 = -9;
        int i4 = 52538;
        int i5 = 0;
        int i31 = -50908;
        int i32 = -230;
        int i33 = 3;
        int i34 = -32974;
        int iArr[] = new int[Test.N];
        long l1 = 1461753066576792058L;
        long lArr[] = new long[Test.N];
        float f = -15.916F;
        double d4 = 0.11082;
        double dArr2[][] = new double[Test.N][Test.N];
        boolean b2 = true;
        char c1 = 44216;
        java.lang.String strArr3[][] = new java.lang.String[Test.N][Test.N];
        Cls O = new Cls();
        Cls O14 = new Cls1();
        FuzzerUtils.init(iArr, -63);
        FuzzerUtils.init(lArr, -3131504936L);
        FuzzerUtils.init(dArr2, 0.105144);
        FuzzerUtils.init(strArr3, "two");
        i2 = 100;        
        while ((i2 -= 2) > 0) {
            l1 = 1;
            while ((l1 += 3) < 31) {
                for (i3 = ((int) (4)); i3 > 1; --i3) {
                    byte by2 = 121;
                    iArr[i3] >>= ~(i4--);
                    switch ((i3 % 8) + 48) {
                        case 48 :
                            {
                                iArr = iArr = iArr = iArr = iArr;
                                Test.strFld1 = "";
                                break;
                            }
                    }
                }
            } 
        }         
        meth_res = i2 + l1 + i3 + i4 + java.lang.Float.floatToIntBits(f) + 
            i5 + i31 + i32 + java.lang.Double.doubleToLongBits(d4) + i33 + 
            (b2 ? 1 : 0) + ((int) (c1)) + i34 + FuzzerUtils.checkSum(iArr) + 
            FuzzerUtils.checkSum(lArr) + java.lang.Double.doubleToLongBits(FuzzerUtils.checkSum(dArr2)) + 
            FuzzerUtils.checkSum(strArr3) + FuzzerUtils.checkSum(O) + FuzzerUtils.checkSum(O14);
        Test.fMeth_check_sum += meth_res;
        return ((float) (meth_res));
    }
    
    public static void vMeth(double d, java.lang.String str, long l) {
        java.lang.Object OArr1[] = new java.lang.Object[68];
        FuzzerUtils.init(OArr1, new Cls2());
        Test.vMeth_check_sum += FuzzerUtils.checkSum(OArr1);
    }

    public void mainTest(java.lang.String[] strArr1) {
        Test.vMeth(81.82491, "four", 176L);
    }

    public static void main(java.lang.String[] args) {
        for (int i = 0; i < 10; i++) {
            try {
                new Test().mainTest(args);
            } catch (java.lang.Exception ex) {
                System.out.println(ex.getClass().getCanonicalName());
            }
        }
        System.out.println("PASS");
    }
}

class Cls1 extends Cls {
    public static final int N = 128;
    public static long instanceCount = -3772599714L;
    public static int iFld = 14;
    public static long iMeth_check_sum = 0;

    public static int iMeth() {
        long meth_res = 0;
        Cls1 O1 = new Cls1();
        Cls1 O11 = new Cls1();
        Cls1 O13 = new Cls1();
        Cls O2 = new Cls();
        Cls O12 = new Cls();
        Cls2.vMeth1(0.2422, -1.708F, Cls1.iFld);
        return ((int) (meth_res));
    }
}

class Cls3 {
    public static final int N = 128;
    public static long instanceCount = -16211L;
}

class Cls {
    public static final int N = 128;
    public static long instanceCount = -4L;
    public static volatile float fFld = -2.206F;
    public short sArrFld1[] = new short[Cls.N];
    public static long Cls_check_sum = 0;
    
    public Cls() {
        Cls.instanceCount++;
        long meth_res = 0;
        int i1 = -62389, i46 = 30, i47 = -5, i48 = 42, i49 = -2,
            i50 = 112, i51 = 4, i52 = 0, i53 = -20, i54 = 9,
            i55 = -36226, i56 = 9, i57 = 63, i58 = 3;
        int iArr3[] = new int[Cls.N];
        byte by4 = -125;
        float f8 = 67.501F;
        float f9 = 68.341F;
        boolean b4 = false;
        Cls3 O21 = new Cls3(), O22 = new Cls3(), 
            O23 = new Cls3(), O24 = new Cls3(), 
            O25 = new Cls3(), O26 = new Cls3(),
            O27 = new Cls3();
        FuzzerUtils.init(iArr3, -172);
        for (i1 = ((int) (94)); i1 > 2; --i1) {
            double d7 = -113.88258;
            d7 += ((double) (i46));
            for (i47 = ((int) (1)); i47 < 17; i47++) {
                i46 <<= -60449;
                i48 <<= ((int) (Cls.instanceCount));
                Test.strFld1 = "";
                Test.strFld1 += Test.strFld1;
                if (i46 != 0) {
                    return;
                }
            }
        }
        return;
    }

}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions