[PATCH] D143049: Use ArrayRef instead of raw pointers. NFC

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 1 10:08:05 PST 2023


efriedma added inline comments.


================
Comment at: llvm/lib/Target/AArch64/AArch64ISelLowering.cpp:14950-14951
+ArrayRef<MCPhysReg> AArch64TargetLowering::getRoundingControlRegisters() const {
+  static const MCPhysReg RCRegs[] = {AArch64::FPCR};
   return RCRegs;
 }
----------------
pengfei wrote:
> Maybe `return {AArch64::FPCR};`?
I'm pretty sure `return {AArch64::FPCR};` would be a use-after-free.  (It allocates an std::initializer_list on the stack, then returns a reference to it.)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D143049/new/

https://reviews.llvm.org/D143049



More information about the llvm-commits mailing list