gh-137681: Always initialize exception handler for new instruction (#137655)

Always initialize exception handler for new instruction
This commit is contained in:
Dino Viehland 2025-08-13 08:58:26 -07:00 committed by GitHub
parent 089a324a42
commit b78e9c05b6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 47 additions and 42 deletions

View file

@ -199,8 +199,10 @@ basicblock_addop(basicblock *b, int opcode, int oparg, location loc)
cfg_instr *i = &b->b_instr[off];
i->i_opcode = opcode;
i->i_oparg = oparg;
i->i_target = NULL;
i->i_loc = loc;
// memory is already zero initialized
assert(i->i_target == NULL);
assert(i->i_except == NULL);
return SUCCESS;
}
@ -1104,6 +1106,7 @@ basicblock_remove_redundant_nops(basicblock *bb) {
assert(dest <= bb->b_iused);
int num_removed = bb->b_iused - dest;
bb->b_iused = dest;
memset(&bb->b_instr[dest], 0, sizeof(cfg_instr) * num_removed);
return num_removed;
}