Skip to content

Commit 893f890

Browse files
committed
move lookup of label to inside if 'it's a jump'
1 parent a2289d1 commit 893f890

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

Python/compile.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9450,10 +9450,12 @@ calculate_jump_targets(basicblock *entryblock)
94509450
for (int i = 0; i < b->b_iused; i++) {
94519451
struct instr *instr = &b->b_instr[i];
94529452
assert(instr->i_target == NULL);
9453-
instr->i_target = label2block[instr->i_target_label.id];
94549453
if (is_jump(instr) || is_block_push(instr)) {
9454+
int lbl = instr->i_target_label.id;
9455+
assert(lbl >= 0 && lbl <= max_label);
9456+
instr->i_target = label2block[lbl];
94559457
assert(instr->i_target != NULL);
9456-
assert(instr->i_target->b_label == instr->i_target_label.id);
9458+
assert(instr->i_target->b_label == lbl);
94579459
}
94589460
instr->i_target_label = NO_LABEL;
94599461
}

0 commit comments

Comments
 (0)