Skip to content
Commit fc1ffb4c authored by Henry Yu's avatar Henry Yu Committed by Peter Rong
Browse files

[AsmPrinter] Fix Crash when Emitting Global Constant of small bit width when...

[AsmPrinter] Fix Crash when Emitting Global Constant of small bit width when targeting Big Endian arch

For Big Endian, the function `emitGlobalConstantLargeInt` tries to right shift `Realigned` by an amount `ExtraBitSize` 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 of `Realigned`, which causes assertion error described in issue [[ https://github.com/llvm/llvm-project/issues/59055 | issue #59055 ]].

This patch fixes the issue by avoiding right shift when bit width is under 64 to avoid the assertion error.

Reviewed By: Peter

Differential Revision: https://reviews.llvm.org/D138246
parent 98286a04
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment