|
| 1 | +/* |
| 2 | + * Copyright (c) 2025, Red Hat, Inc. All rights reserved. |
| 3 | + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
| 4 | + * |
| 5 | + * This code is free software; you can redistribute it and/or modify it |
| 6 | + * under the terms of the GNU General Public License version 2 only, as |
| 7 | + * published by the Free Software Foundation. |
| 8 | + * |
| 9 | + * This code is distributed in the hope that it will be useful, but WITHOUT |
| 10 | + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
| 11 | + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
| 12 | + * version 2 for more details (a copy is included in the LICENSE file that |
| 13 | + * accompanied this code). |
| 14 | + * |
| 15 | + * You should have received a copy of the GNU General Public License version |
| 16 | + * 2 along with this work; if not, write to the Free Software Foundation, |
| 17 | + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
| 18 | + * |
| 19 | + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
| 20 | + * or visit www.oracle.com if you need additional information or have any |
| 21 | + * questions. |
| 22 | + */ |
| 23 | + |
| 24 | +/* |
| 25 | + * @test |
| 26 | + * @bug 8355230 |
| 27 | + * @summary Crash in fuzzer tests: assert(n != nullptr) failed: must not be null |
| 28 | + * @run main/othervm -XX:CompileCommand=compileonly,TestNullRegionInputAtPhiMakePathDead::* -Xcomp TestNullRegionInputAtPhiMakePathDead |
| 29 | + */ |
| 30 | + |
| 31 | +public class TestNullRegionInputAtPhiMakePathDead { |
| 32 | + |
| 33 | + public static long instanceCount=-37082278491330812L; |
| 34 | + public static float fFld=1.509F; |
| 35 | + public static int iFld=89; |
| 36 | + |
| 37 | + public static long vMeth_check_sum = 0; |
| 38 | + |
| 39 | + public void mainTest() { |
| 40 | + |
| 41 | + int i19, i20=13736, i21, i24=5; |
| 42 | + boolean b2=true; |
| 43 | + |
| 44 | + double d; |
| 45 | + int i3; |
| 46 | + |
| 47 | + for (d = 5; d < 131; ++d) { |
| 48 | + i3 = 12; |
| 49 | + while (--i3 > 0) { |
| 50 | + TestNullRegionInputAtPhiMakePathDead.fFld *= -31237; |
| 51 | + } |
| 52 | + } |
| 53 | + TestNullRegionInputAtPhiMakePathDead.fFld %= 16334; |
| 54 | + TestNullRegionInputAtPhiMakePathDead.instanceCount = 0; |
| 55 | + for (i19 = 2; i19 < 281; i19++) { |
| 56 | + try { |
| 57 | + TestNullRegionInputAtPhiMakePathDead.iFld = (57 % i20); |
| 58 | + } catch (ArithmeticException a_e) {} |
| 59 | + i20 += (((i19 * TestNullRegionInputAtPhiMakePathDead.fFld) + TestNullRegionInputAtPhiMakePathDead.instanceCount) - i19); |
| 60 | + for (i21 = i19; i21 < 90; i21++) { |
| 61 | + if (b2) { |
| 62 | + } else { |
| 63 | + // CastII of b2 to false added here becomes top during igvn. It's used by a Phi |
| 64 | + // at a Region that merges paths from the switch and if. Some of those paths are |
| 65 | + // found unreachable at parse time but added to the Region anyway. |
| 66 | + switch ((((i21 >>> 1) % 4) * 5) + 115) { |
| 67 | + case 129: |
| 68 | + break; |
| 69 | + case 135: |
| 70 | + i24 |= i24; |
| 71 | + } |
| 72 | + } |
| 73 | + } |
| 74 | + } |
| 75 | + |
| 76 | + System.out.println("vMeth_check_sum: " + vMeth_check_sum); |
| 77 | + } |
| 78 | + public static void main(String[] strArr) { |
| 79 | + try { |
| 80 | + TestNullRegionInputAtPhiMakePathDead _instance = new TestNullRegionInputAtPhiMakePathDead(); |
| 81 | + for (int i = 0; i < 10; i++ ) { |
| 82 | + _instance.mainTest(); |
| 83 | + } |
| 84 | + } catch (Exception ex) { |
| 85 | + } |
| 86 | + } |
| 87 | +} |
0 commit comments