Skip to content

Commit

Permalink
i#3044: Always initialise sizes for registers (#6401)
Browse files Browse the repository at this point in the history
This patch makes sure that the size and element size for predicate and
vector registers are always initialised which will avoid potential
issues when comparing registers

issue: #3044
  • Loading branch information
joshua-warburton authored Oct 30, 2023
1 parent 2f7a093 commit 862fcff
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions core/ir/instr_inline_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,7 @@ opnd_create_reg_element_vector(reg_id_t r, opnd_size_t element_size)
CLIENT_ASSERT(element_size == 0 || (r <= DR_REG_LAST_ENUM && r != DR_REG_INVALID),
"opnd_create_reg_element_vector: invalid register or no size");
opnd.kind = REG_kind;
opnd.size = 0; /* indicates full size of reg */
opnd.value.reg_and_element_size.reg = r;
opnd.value.reg_and_element_size.element_size = element_size;
opnd.aux.flags = DR_OPND_IS_VECTOR;
Expand All @@ -310,7 +311,9 @@ opnd_create_predicate_reg(reg_id_t r, bool is_merge)
"opnd_create_predicate_reg: invalid predicate register");

opnd.kind = REG_kind;
opnd.size = 0; /* indicates full size of reg */
opnd.value.reg_and_element_size.reg = r;
opnd.value.reg_and_element_size.element_size = OPSZ_NA;
opnd.aux.flags =
(ushort)(is_merge ? DR_OPND_IS_MERGE_PREDICATE : DR_OPND_IS_ZERO_PREDICATE);
return opnd;
Expand Down

0 comments on commit 862fcff

Please sign in to comment.