1: 2: // test uninitialized variable detection (program will not run) 3: 4: void main ( ) 5: { 6: int a,b,c,d,e,f,x; 7: 8: if ( x != 0 ) 9: { 10: a = 4; 11: c = 5 - d; 12: } 13: else 14: { 15: a = 6 + b; 16: b = 3 - c; 17: } 18: 19: if ( x < 2 ) 20: { 21: b = 5 + c; 22: } 23: else 24: { 25: d = 6 + b; 26: } 27: 28: f = a + 2; 29: a = b + c; 30: c = e + d; 31: b = f + 1; 32: e = a - 3; 33: 34: x = a + b + c + d + e + f; 35: printInt(x); 36: } ** Global Variables ** printLn, void, function, param = main, void, function, param = printStr, void, function, param = String printInt, void, function, param = int ** Local Variables in main() ** d, int a, int c, int f, int b, int x, int e, int TREE_PROC: main { TREE_IF: CONDITION: (x NE_OP 0) { TREE_INSTR: a = 4 TREE_INSTR: c = (5 MINUS d) } ELSE: { TREE_INSTR: a = (6 PLUS b) TREE_INSTR: b = (3 MINUS c) } END_IF TREE_IF: CONDITION: (x LESS 2) { TREE_INSTR: b = (5 PLUS c) } ELSE: { TREE_INSTR: d = (6 PLUS b) } END_IF TREE_INSTR: f = (a PLUS 2) TREE_INSTR: a = (b PLUS c) TREE_INSTR: c = (e PLUS d) TREE_INSTR: b = (f PLUS 1) TREE_INSTR: e = (a MINUS 3) TREE_INSTR: x = (((((a PLUS b) PLUS c) PLUS d) PLUS e) PLUS f) TREE_INSTR: CALL printInt(x) } END_PROC ** Basic block: 0 ** Length: 1 Successors: 1 Predecessors: GEN {6} KILL {} IN {1, 3, 5, 6, 7} OUT {1, 3, 5, 6, 7} > 0: iload 6 ** Basic block: 1 ** Length: 1 Successors: 2 Predecessors: 0 GEN {} KILL {} IN {1, 3, 5, 6, 7} OUT {1, 3, 5, 6, 7} > 2: iconst_0 ** Basic block: 2 ** Length: 1 Successors: 3 5 Predecessors: 1 GEN {} KILL {} IN {1, 3, 5, 6, 7} OUT {1, 3, 5, 6, 7} > 3: if_icmpne -> 11 ** Basic block: 3 ** Length: 1 Successors: 4 Predecessors: 2 GEN {} KILL {} IN {1, 3, 5, 6, 7} OUT {1, 3, 5, 6, 7} > 6: iconst_0 ** Basic block: 4 ** Length: 1 Successors: 6 Predecessors: 3 GEN {} KILL {} IN {1, 3, 5, 6, 7} OUT {1, 3, 5, 6, 7} > 7: goto -> 13 ** Basic block: 5 ** Length: 1 Successors: 6 Predecessors: 2 GEN {} KILL {} IN {1, 3, 5, 6, 7} OUT {1, 3, 5, 6, 7} > 11: iconst_1 ** Basic block: 6 ** Length: 1 Successors: 7 14 Predecessors: 4 5 GEN {} KILL {} IN {1, 3, 5, 6, 7} OUT {1, 3, 5, 6, 7} > 13: ifeq -> 26 ** Basic block: 7 ** Length: 1 Successors: 8 Predecessors: 6 GEN {} KILL {} IN {1, 5, 6, 7} OUT {1, 5, 6, 7} > 16: iconst_4 ** Basic block: 8 ** Length: 1 Successors: 9 Predecessors: 7 GEN {} KILL {2} IN {1, 5, 6, 7} OUT {1, 2, 5, 6, 7} > 17: istore_2 ** Basic block: 9 ** Length: 1 Successors: 10 Predecessors: 8 GEN {} KILL {} IN {1, 2, 5, 6, 7} OUT {1, 2, 5, 6, 7} > 18: iconst_5 ** Basic block: 10 ** Length: 1 Successors: 11 Predecessors: 9 GEN {1} KILL {} IN {1, 2, 5, 6, 7} OUT {1, 2, 5, 6, 7} > 19: iload_1 ** Basic block: 11 ** Length: 1 Successors: 12 Predecessors: 10 GEN {} KILL {} IN {1, 2, 5, 6, 7} OUT {1, 2, 5, 6, 7} > 20: isub ** Basic block: 12 ** Length: 1 Successors: 13 Predecessors: 11 GEN {} KILL {3} IN {1, 2, 5, 6, 7} OUT {1, 2, 3, 5, 6, 7} > 21: istore_3 ** Basic block: 13 ** Length: 1 Successors: 22 Predecessors: 12 GEN {} KILL {} IN {1, 2, 3, 5, 6, 7} OUT {1, 2, 3, 5, 6, 7} > 22: goto -> 38 ** Basic block: 14 ** Length: 1 Successors: 15 Predecessors: 6 GEN {} KILL {} IN {1, 3, 5, 6, 7} OUT {1, 3, 5, 6, 7} > 26: bipush 6 ** Basic block: 15 ** Length: 1 Successors: 16 Predecessors: 14 GEN {5} KILL {} IN {1, 3, 5, 6, 7} OUT {1, 3, 6, 7} > 28: iload 5 ** Basic block: 16 ** Length: 1 Successors: 17 Predecessors: 15 GEN {} KILL {} IN {1, 3, 6, 7} OUT {1, 3, 6, 7} > 30: iadd ** Basic block: 17 ** Length: 1 Successors: 18 Predecessors: 16 GEN {} KILL {2} IN {1, 3, 6, 7} OUT {1, 2, 3, 6, 7} > 31: istore_2 ** Basic block: 18 ** Length: 1 Successors: 19 Predecessors: 17 GEN {} KILL {} IN {1, 2, 3, 6, 7} OUT {1, 2, 3, 6, 7} > 32: iconst_3 ** Basic block: 19 ** Length: 1 Successors: 20 Predecessors: 18 GEN {3} KILL {} IN {1, 2, 3, 6, 7} OUT {1, 2, 3, 6, 7} > 33: iload_3 ** Basic block: 20 ** Length: 1 Successors: 21 Predecessors: 19 GEN {} KILL {} IN {1, 2, 3, 6, 7} OUT {1, 2, 3, 6, 7} > 34: isub ** Basic block: 21 ** Length: 1 Successors: 22 Predecessors: 20 GEN {} KILL {5} IN {1, 2, 3, 6, 7} OUT {1, 2, 3, 5, 6, 7} > 35: istore 5 ** Basic block: 22 ** Length: 1 Successors: 23 Predecessors: 13 21 GEN {6} KILL {} IN {1, 2, 3, 5, 6, 7} OUT {1, 2, 3, 5, 7} > 38: iload 6 ** Basic block: 23 ** Length: 1 Successors: 24 Predecessors: 22 GEN {} KILL {} IN {1, 2, 3, 5, 7} OUT {1, 2, 3, 5, 7} > 40: iconst_2 ** Basic block: 24 ** Length: 1 Successors: 25 27 Predecessors: 23 GEN {} KILL {} IN {1, 2, 3, 5, 7} OUT {1, 2, 3, 5, 7} > 41: if_icmplt -> 49 ** Basic block: 25 ** Length: 1 Successors: 26 Predecessors: 24 GEN {} KILL {} IN {1, 2, 3, 5, 7} OUT {1, 2, 3, 5, 7} > 44: iconst_0 ** Basic block: 26 ** Length: 1 Successors: 28 Predecessors: 25 GEN {} KILL {} IN {1, 2, 3, 5, 7} OUT {1, 2, 3, 5, 7} > 45: goto -> 51 ** Basic block: 27 ** Length: 1 Successors: 28 Predecessors: 24 GEN {} KILL {} IN {1, 2, 3, 5, 7} OUT {1, 2, 3, 5, 7} > 49: iconst_1 ** Basic block: 28 ** Length: 1 Successors: 29 34 Predecessors: 26 27 GEN {} KILL {} IN {1, 2, 3, 5, 7} OUT {1, 2, 3, 5, 7} > 51: ifeq -> 63 ** Basic block: 29 ** Length: 1 Successors: 30 Predecessors: 28 GEN {} KILL {} IN {1, 2, 3, 7} OUT {1, 2, 3, 7} > 54: iconst_5 ** Basic block: 30 ** Length: 1 Successors: 31 Predecessors: 29 GEN {3} KILL {} IN {1, 2, 3, 7} OUT {1, 2, 3, 7} > 55: iload_3 ** Basic block: 31 ** Length: 1 Successors: 32 Predecessors: 30 GEN {} KILL {} IN {1, 2, 3, 7} OUT {1, 2, 3, 7} > 56: iadd ** Basic block: 32 ** Length: 1 Successors: 33 Predecessors: 31 GEN {} KILL {5} IN {1, 2, 3, 7} OUT {1, 2, 3, 5, 7} > 57: istore 5 ** Basic block: 33 ** Length: 1 Successors: 38 Predecessors: 32 GEN {} KILL {} IN {1, 2, 3, 5, 7} OUT {1, 2, 3, 5, 7} > 59: goto -> 70 ** Basic block: 34 ** Length: 1 Successors: 35 Predecessors: 28 GEN {} KILL {} IN {2, 3, 5, 7} OUT {2, 3, 5, 7} > 63: bipush 6 ** Basic block: 35 ** Length: 1 Successors: 36 Predecessors: 34 GEN {5} KILL {} IN {2, 3, 5, 7} OUT {2, 3, 5, 7} > 65: iload 5 ** Basic block: 36 ** Length: 1 Successors: 37 Predecessors: 35 GEN {} KILL {} IN {2, 3, 5, 7} OUT {2, 3, 5, 7} > 67: iadd ** Basic block: 37 ** Length: 1 Successors: 38 Predecessors: 36 GEN {} KILL {1} IN {2, 3, 5, 7} OUT {1, 2, 3, 5, 7} > 68: istore_1 ** Basic block: 38 ** Length: 1 Successors: 39 Predecessors: 33 37 GEN {2} KILL {} IN {1, 2, 3, 5, 7} OUT {1, 3, 5, 7} > 70: iload_2 ** Basic block: 39 ** Length: 1 Successors: 40 Predecessors: 38 GEN {} KILL {} IN {1, 3, 5, 7} OUT {1, 3, 5, 7} > 71: iconst_2 ** Basic block: 40 ** Length: 1 Successors: 41 Predecessors: 39 GEN {} KILL {} IN {1, 3, 5, 7} OUT {1, 3, 5, 7} > 72: iadd ** Basic block: 41 ** Length: 1 Successors: 42 Predecessors: 40 GEN {} KILL {4} IN {1, 3, 5, 7} OUT {1, 3, 4, 5, 7} > 73: istore 4 ** Basic block: 42 ** Length: 1 Successors: 43 Predecessors: 41 GEN {5} KILL {} IN {1, 3, 4, 5, 7} OUT {1, 3, 4, 7} > 75: iload 5 ** Basic block: 43 ** Length: 1 Successors: 44 Predecessors: 42 GEN {3} KILL {} IN {1, 3, 4, 7} OUT {1, 4, 7} > 77: iload_3 ** Basic block: 44 ** Length: 1 Successors: 45 Predecessors: 43 GEN {} KILL {} IN {1, 4, 7} OUT {1, 4, 7} > 78: iadd ** Basic block: 45 ** Length: 1 Successors: 46 Predecessors: 44 GEN {} KILL {2} IN {1, 4, 7} OUT {1, 2, 4, 7} > 79: istore_2 ** Basic block: 46 ** Length: 1 Successors: 47 Predecessors: 45 GEN {7} KILL {} IN {1, 2, 4, 7} OUT {1, 2, 4} > 80: iload 7 ** Basic block: 47 ** Length: 1 Successors: 48 Predecessors: 46 GEN {1} KILL {} IN {1, 2, 4} OUT {1, 2, 4} > 82: iload_1 ** Basic block: 48 ** Length: 1 Successors: 49 Predecessors: 47 GEN {} KILL {} IN {1, 2, 4} OUT {1, 2, 4} > 83: iadd ** Basic block: 49 ** Length: 1 Successors: 50 Predecessors: 48 GEN {} KILL {3} IN {1, 2, 4} OUT {1, 2, 3, 4} > 84: istore_3 ** Basic block: 50 ** Length: 1 Successors: 51 Predecessors: 49 GEN {4} KILL {} IN {1, 2, 3, 4} OUT {1, 2, 3, 4} > 85: iload 4 ** Basic block: 51 ** Length: 1 Successors: 52 Predecessors: 50 GEN {} KILL {} IN {1, 2, 3, 4} OUT {1, 2, 3, 4} > 87: iconst_1 ** Basic block: 52 ** Length: 1 Successors: 53 Predecessors: 51 GEN {} KILL {} IN {1, 2, 3, 4} OUT {1, 2, 3, 4} > 88: iadd ** Basic block: 53 ** Length: 1 Successors: 54 Predecessors: 52 GEN {} KILL {5} IN {1, 2, 3, 4} OUT {1, 2, 3, 4, 5} > 89: istore 5 ** Basic block: 54 ** Length: 1 Successors: 55 Predecessors: 53 GEN {2} KILL {} IN {1, 2, 3, 4, 5} OUT {1, 2, 3, 4, 5} > 91: iload_2 ** Basic block: 55 ** Length: 1 Successors: 56 Predecessors: 54 GEN {} KILL {} IN {1, 2, 3, 4, 5} OUT {1, 2, 3, 4, 5} > 92: iconst_3 ** Basic block: 56 ** Length: 1 Successors: 57 Predecessors: 55 GEN {} KILL {} IN {1, 2, 3, 4, 5} OUT {1, 2, 3, 4, 5} > 93: isub ** Basic block: 57 ** Length: 1 Successors: 58 Predecessors: 56 GEN {} KILL {7} IN {1, 2, 3, 4, 5} OUT {1, 2, 3, 4, 5, 7} > 94: istore 7 ** Basic block: 58 ** Length: 1 Successors: 59 Predecessors: 57 GEN {2} KILL {} IN {1, 2, 3, 4, 5, 7} OUT {1, 3, 4, 5, 7} > 96: iload_2 ** Basic block: 59 ** Length: 1 Successors: 60 Predecessors: 58 GEN {5} KILL {} IN {1, 3, 4, 5, 7} OUT {1, 3, 4, 7} > 97: iload 5 ** Basic block: 60 ** Length: 1 Successors: 61 Predecessors: 59 GEN {} KILL {} IN {1, 3, 4, 7} OUT {1, 3, 4, 7} > 99: iadd ** Basic block: 61 ** Length: 1 Successors: 62 Predecessors: 60 GEN {3} KILL {} IN {1, 3, 4, 7} OUT {1, 4, 7} > 100: iload_3 ** Basic block: 62 ** Length: 1 Successors: 63 Predecessors: 61 GEN {} KILL {} IN {1, 4, 7} OUT {1, 4, 7} > 101: iadd ** Basic block: 63 ** Length: 1 Successors: 64 Predecessors: 62 GEN {1} KILL {} IN {1, 4, 7} OUT {4, 7} > 102: iload_1 ** Basic block: 64 ** Length: 1 Successors: 65 Predecessors: 63 GEN {} KILL {} IN {4, 7} OUT {4, 7} > 103: iadd ** Basic block: 65 ** Length: 1 Successors: 66 Predecessors: 64 GEN {7} KILL {} IN {4, 7} OUT {4} > 104: iload 7 ** Basic block: 66 ** Length: 1 Successors: 67 Predecessors: 65 GEN {} KILL {} IN {4} OUT {4} > 106: iadd ** Basic block: 67 ** Length: 1 Successors: 68 Predecessors: 66 GEN {4} KILL {} IN {4} OUT {} > 107: iload 4 ** Basic block: 68 ** Length: 1 Successors: 69 Predecessors: 67 GEN {} KILL {} IN {} OUT {} > 109: iadd ** Basic block: 69 ** Length: 1 Successors: 70 Predecessors: 68 GEN {} KILL {6} IN {} OUT {6} > 110: istore 6 ** Basic block: 70 ** Length: 1 Successors: 71 Predecessors: 69 GEN {} KILL {} IN {6} OUT {6} > 112: getstatic 12 ** Basic block: 71 ** Length: 1 Successors: 72 Predecessors: 70 GEN {6} KILL {} IN {6} OUT {} > 115: iload 6 ** Basic block: 72 ** Length: 1 Successors: 73 Predecessors: 71 GEN {} KILL {} IN {} OUT {} > 117: invokevirtual 29 ** Basic block: 73 ** Length: 1 Successors: 74 Predecessors: 72 GEN {} KILL {} IN {} OUT {} > 120: return ** Basic block: 74 ** Length: 0 Successors: Predecessors: 73 GEN {} KILL {} IN {} OUT {} <<---- Live Ranges ---->> [B 0] [Live 1 3 5 6 7 ] 0: iload 6 [B 1] [Live 1 3 5 6 7 ] 2: iconst_0 [B 2] [Live 1 3 5 6 7 ] 3: if_icmpne -> 11 [B 3] [Live 1 3 5 6 7 ] 6: iconst_0 [B 4] [Live 1 3 5 6 7 ] 7: goto -> 13 [B 5] [Live 1 3 5 6 7 ] 11: iconst_1 [B 6] [Live 1 3 5 6 7 ] 13: ifeq -> 26 [B 7] [Live 1 5 6 7 ] 16: iconst_4 [B 8] [Live 1 5 6 7 ] 17: istore_2 [B 9] [Live 1 2 5 6 7 ] 18: iconst_5 [B 10] [Live 1 2 5 6 7 ] 19: iload_1 [B 11] [Live 1 2 5 6 7 ] 20: isub [B 12] [Live 1 2 5 6 7 ] 21: istore_3 [B 13] [Live 1 2 3 5 6 7 ] 22: goto -> 38 [B 14] [Live 1 3 5 6 7 ] 26: bipush 6 [B 15] [Live 1 3 5 6 7 ] 28: iload 5 [B 16] [Live 1 3 6 7 ] 30: iadd [B 17] [Live 1 3 6 7 ] 31: istore_2 [B 18] [Live 1 2 3 6 7 ] 32: iconst_3 [B 19] [Live 1 2 3 6 7 ] 33: iload_3 [B 20] [Live 1 2 3 6 7 ] 34: isub [B 21] [Live 1 2 3 6 7 ] 35: istore 5 [B 22] [Live 1 2 3 5 6 7 ] 38: iload 6 [B 23] [Live 1 2 3 5 7 ] 40: iconst_2 [B 24] [Live 1 2 3 5 7 ] 41: if_icmplt -> 49 [B 25] [Live 1 2 3 5 7 ] 44: iconst_0 [B 26] [Live 1 2 3 5 7 ] 45: goto -> 51 [B 27] [Live 1 2 3 5 7 ] 49: iconst_1 [B 28] [Live 1 2 3 5 7 ] 51: ifeq -> 63 [B 29] [Live 1 2 3 7 ] 54: iconst_5 [B 30] [Live 1 2 3 7 ] 55: iload_3 [B 31] [Live 1 2 3 7 ] 56: iadd [B 32] [Live 1 2 3 7 ] 57: istore 5 [B 33] [Live 1 2 3 5 7 ] 59: goto -> 70 [B 34] [Live 2 3 5 7 ] 63: bipush 6 [B 35] [Live 2 3 5 7 ] 65: iload 5 [B 36] [Live 2 3 5 7 ] 67: iadd [B 37] [Live 2 3 5 7 ] 68: istore_1 [B 38] [Live 1 2 3 5 7 ] 70: iload_2 [B 39] [Live 1 3 5 7 ] 71: iconst_2 [B 40] [Live 1 3 5 7 ] 72: iadd [B 41] [Live 1 3 5 7 ] 73: istore 4 [B 42] [Live 1 3 4 5 7 ] 75: iload 5 [B 43] [Live 1 3 4 7 ] 77: iload_3 [B 44] [Live 1 4 7 ] 78: iadd [B 45] [Live 1 4 7 ] 79: istore_2 [B 46] [Live 1 2 4 7 ] 80: iload 7 [B 47] [Live 1 2 4 ] 82: iload_1 [B 48] [Live 1 2 4 ] 83: iadd [B 49] [Live 1 2 4 ] 84: istore_3 [B 50] [Live 1 2 3 4 ] 85: iload 4 [B 51] [Live 1 2 3 4 ] 87: iconst_1 [B 52] [Live 1 2 3 4 ] 88: iadd [B 53] [Live 1 2 3 4 ] 89: istore 5 [B 54] [Live 1 2 3 4 5 ] 91: iload_2 [B 55] [Live 1 2 3 4 5 ] 92: iconst_3 [B 56] [Live 1 2 3 4 5 ] 93: isub [B 57] [Live 1 2 3 4 5 ] 94: istore 7 [B 58] [Live 1 2 3 4 5 7 ] 96: iload_2 [B 59] [Live 1 3 4 5 7 ] 97: iload 5 [B 60] [Live 1 3 4 7 ] 99: iadd [B 61] [Live 1 3 4 7 ] 100: iload_3 [B 62] [Live 1 4 7 ] 101: iadd [B 63] [Live 1 4 7 ] 102: iload_1 [B 64] [Live 4 7 ] 103: iadd [B 65] [Live 4 7 ] 104: iload 7 [B 66] [Live 4 ] 106: iadd [B 67] [Live 4 ] 107: iload 4 [B 68] [Live ] 109: iadd [B 69] [Live ] 110: istore 6 [B 70] [Live 6 ] 112: getstatic 12 [B 71] [Live 6 ] 115: iload 6 [B 72] [Live ] 117: invokevirtual 29 [B 73] [Live ] 120: return WARNING: possible uninitialized local variable index 1 WARNING: possible uninitialized local variable index 3 WARNING: possible uninitialized local variable index 5 WARNING: possible uninitialized local variable index 6 WARNING: possible uninitialized local variable index 7 <<---- Local Variables in main() ---->> LocalVariable(start_pc = 0, length = 112, index = 0:String[] argv) LocalVariable(start_pc = 0, length = 112, index = 1:int d) LocalVariable(start_pc = 0, length = 112, index = 2:int a) LocalVariable(start_pc = 0, length = 112, index = 3:int c) LocalVariable(start_pc = 0, length = 112, index = 4:int f) LocalVariable(start_pc = 0, length = 112, index = 5:int b) LocalVariable(start_pc = 0, length = 112, index = 6:int x) LocalVariable(start_pc = 0, length = 112, index = 7:int e) <<---- Global Variables ---->> Compiled from "" public class test6 extends java.lang.Object{ public static void main(java.lang.String[]); Code: 0: iload 6 2: iconst_0 3: if_icmpne 10 6: iconst_0 7: goto 11 10: iconst_1 11: ifeq 23 14: iconst_4 15: istore_2 16: iconst_5 17: iload_1 18: isub 19: istore_3 20: goto 34 23: bipush 6 25: iload 5 27: iadd 28: istore_2 29: iconst_3 30: iload_3 31: isub 32: istore 5 34: iload 6 36: iconst_2 37: if_icmplt 44 40: iconst_0 41: goto 45 44: iconst_1 45: ifeq 56 48: iconst_5 49: iload_3 50: iadd 51: istore 5 53: goto 62 56: bipush 6 58: iload 5 60: iadd 61: istore_1 62: iload_2 63: iconst_2 64: iadd 65: istore 4 67: iload 5 69: iload_3 70: iadd 71: istore_2 72: iload 7 74: iload_1 75: iadd 76: istore_3 77: iload 4 79: iconst_1 80: iadd 81: istore 5 83: iload_2 84: iconst_3 85: isub 86: istore 7 88: iload_2 89: iload 5 91: iadd 92: iload_3 93: iadd 94: iload_1 95: iadd 96: iload 7 98: iadd 99: iload 4 101: iadd 102: istore 6 104: getstatic #12; //Field java/lang/System.out:Ljava/io/PrintStream; 107: iload 6 109: invokevirtual #29; //Method java/io/PrintStream.print:(I)V 112: return public test6(); Code: 0: aload_0 1: invokespecial #44; //Method java/lang/Object."":()V 4: return }