[llvm] Fix i1 array global crash in NVPTXAsmPrinter. (PR #92506)
Johannes Reifferscheid via llvm-commits
llvm-commits at lists.llvm.org
Sat May 18 00:00:19 PDT 2024
================
@@ -1847,9 +1847,13 @@ void NVPTXAsmPrinter::bufferLEByte(const Constant *CPV, int Bytes,
auto AddIntToBuffer = [AggBuffer, Bytes](const APInt &Val) {
size_t NumBytes = (Val.getBitWidth() + 7) / 8;
SmallVector<unsigned char, 16> Buf(NumBytes);
- for (unsigned I = 0; I < NumBytes; ++I) {
+ for (unsigned I = 0; I < NumBytes - 1; ++I) {
----------------
jreiffers wrote:
It's explained in the PR description, also look at the test. If the type's bitwidth is not a multiple of 8, the old code crashes.
https://github.com/llvm/llvm-project/pull/92506
More information about the llvm-commits
mailing list