Skip to content

Commit c0562ff

Browse files
committed
[AVR] Fix UB "left shift of negative value" detected by sanitizer
Introduced by 1793fa8.
1 parent 619f478 commit c0562ff

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

llvm/lib/Target/AVR/Disassembler/AVRDisassembler.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,15 +110,15 @@ static DecodeStatus decodeRelCondBrTarget7(MCInst &Inst, unsigned Field,
110110
uint64_t Address,
111111
const MCDisassembler *Decoder) {
112112
// The legal range is [-128, 126] (in bytes).
113-
Inst.addOperand(MCOperand::createImm(SignExtend32(Field, 7) << 1));
113+
Inst.addOperand(MCOperand::createImm(SignExtend32(Field, 7) * 2));
114114
return MCDisassembler::Success;
115115
}
116116

117117
static DecodeStatus decodeRelCondBrTarget13(MCInst &Inst, unsigned Field,
118118
uint64_t Address,
119119
const MCDisassembler *Decoder) {
120120
// The legal range is [-4096, 4094] (in bytes).
121-
Inst.addOperand(MCOperand::createImm(SignExtend32(Field, 12) << 1));
121+
Inst.addOperand(MCOperand::createImm(SignExtend32(Field, 12) * 2));
122122
return MCDisassembler::Success;
123123
}
124124

0 commit comments

Comments
 (0)