[AsmPrinter] Global Constant with Big Endian crashes backend with assertion ShiftAmt <= BitWidth && "Invalid shift amount"
failed
#59055
Labels
ShiftAmt <= BitWidth && "Invalid shift amount"
failed
#59055
Description
When targeting
aarch64_be
, the following code crashes the backend with errorShiftAmt <= BitWidth && "Invalid shift amount"
.This does not occur when targeting
aarch64
.Minimal Reproduction
https://godbolt.org/z/sf17n5Me6
Code
Stack Trace
Cause
The following code from function
emitGlobalConstantLargeInt
inAsmPrinter.cpp
tries to right shiftRealigned
by an amountExtraBitSize
in place. However, if the constant to emit has a bit width less than 64 and the bit width is not a multiple of 8, the shift amount will be greater than the bit width ofRealigned
, which causes the crash.llvm-project/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
Lines 3243 to 3274 in aecae68
The text was updated successfully, but these errors were encountered: