Skip to content

Commit 36477f7

Browse files
committed
[XCOFF] Fix UB 'left shift of negative value' after #72532
1 parent 1bce61e commit 36477f7

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

llvm/lib/Target/PowerPC/MCTargetDesc/PPCInstPrinter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -484,7 +484,7 @@ void PPCInstPrinter::printAbsBranchOperand(const MCInst *MI, unsigned OpNo,
484484
if (!MI->getOperand(OpNo).isImm())
485485
return printOperand(MI, OpNo, STI, O);
486486

487-
uint64_t Imm = MI->getOperand(OpNo).getImm() << 2;
487+
uint64_t Imm = static_cast<uint64_t>(MI->getOperand(OpNo).getImm()) << 2;
488488
if (!TT.isPPC64())
489489
Imm = static_cast<uint32_t>(Imm);
490490
O << formatHex(Imm);

0 commit comments

Comments
 (0)