[PATCH] D65347: [RISCV] Fix uninitialized variable after call to evaluateConstantImm

Francis Visoiu Mistrih via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 26 13:35:44 PDT 2019


thegameg created this revision.
thegameg added reviewers: lewis-revill, asb, jrtc27, rogfer01.
Herald added subscribers: s.egerton, lenary, Jim, benna, psnobl, jocewei, PkmX, rkruppe, the_o, brucehoult, MartinMosbeck, edward-jones, zzheng, MaskRay, shiva0217, kito-cheng, niosHD, sabuasal, apazos, simoncook, johnrusso, rbar, hiraditya.
Herald added a project: LLVM.

For `llvm/test/MC/RISCV/rv64i-aliases-invalid.s`, UBSan reports:

  lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp:371:9: runtime error: load of value 3879186881, which is not a valid value for type 'RISCVMCExpr::VariantKind'
   SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp:371:9 in

It turns out that evaluateConstantImm does not set `VK` and it remains unitialized when doing comparisons in `isImmXLenLI()`.


https://reviews.llvm.org/D65347

Files:
  llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D65347.211995.patch
Type: text/x-patch
Size: 6857 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190726/1320e379/attachment-0001.bin>


More information about the llvm-commits mailing list