From e2b07451b8f66a77a4f61b501272aa3575830a34 Mon Sep 17 00:00:00 2001 From: Zdenek Zambersky Date: Wed, 5 Nov 2025 13:48:35 +0100 Subject: [PATCH] Fix compilation errors on VS2010 --- jdk/src/share/native/common/check_code.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/jdk/src/share/native/common/check_code.c b/jdk/src/share/native/common/check_code.c index 0889c57f49..2b43b3e46a 100644 --- a/jdk/src/share/native/common/check_code.c +++ b/jdk/src/share/native/common/check_code.c @@ -1161,10 +1161,11 @@ verify_opcode_operands(context_type *context, unsigned int inumber, int offset) case JVM_OPC_if_acmpeq: case JVM_OPC_if_acmpne: case JVM_OPC_goto: { /* Set the ->operand to be the instruction number of the target. */ - int jump = (((signed char)(code[offset+1])) << 8) + code[offset+2]; + int jump, target; + jump = (((signed char)(code[offset+1])) << 8) + code[offset+2]; if (!isLegalOffset(context, offset, jump)) CCerror(context, "Illegal target of jump or branch"); - int target = offset + jump; + target = offset + jump; this_idata->operand.i = code_data[target]; break; } @@ -1175,12 +1176,13 @@ verify_opcode_operands(context_type *context, unsigned int inumber, int offset) /* FALLTHROUGH */ case JVM_OPC_goto_w: { /* Set the ->operand to be the instruction number of the target. */ - int jump = (((signed char)(code[offset+1])) << 24) + + int jump, target; + jump = (((signed char)(code[offset+1])) << 24) + (code[offset+2] << 16) + (code[offset+3] << 8) + (code[offset + 4]); if (!isLegalOffset(context, offset, jump)) CCerror(context, "Illegal target of jump or branch"); - int target = offset + jump; + target = offset + jump; this_idata->operand.i = code_data[target]; break; } @@ -1193,6 +1195,7 @@ verify_opcode_operands(context_type *context, unsigned int inumber, int offset) int *saved_operand; int keys; int k, delta; + int jump, target; if (context->major_version < NONZERO_PADDING_BYTES_IN_SWITCH_MAJOR_VERSION) { /* 4639449, 4647081: Padding bytes must be zero. */ @@ -1219,10 +1222,10 @@ verify_opcode_operands(context_type *context, unsigned int inumber, int offset) } } saved_operand = NEW(int, keys + 2); - int jump = _ck_ntohl(lpc[0]); + jump = _ck_ntohl(lpc[0]); if (!isLegalOffset(context, offset, jump)) CCerror(context, "Illegal default target in switch"); - int target = offset + jump; + target = offset + jump; saved_operand[keys + 1] = code_data[target]; for (k = keys, lptr = &lpc[3]; --k >= 0; lptr += delta) { jump = _ck_ntohl(lptr[0]); @@ -1765,8 +1768,9 @@ isLegalOffset(context_type *context, int bci, int offset) int *code_data = context->code_data; int max_offset = 65535; // JVMS 4.11 int min_offset = -65535; + int target; if (offset < min_offset || offset > max_offset) return JNI_FALSE; - int target = bci + offset; + target = bci + offset; return (target >= 0 && target < code_length && code_data[target] >= 0); }