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

Phoebe Wang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 1 18:46:45 PST 2023


pengfei 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;
 }
----------------
efriedma wrote:
> 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.)
Thanke @efriedma! You are right https://godbolt.org/z/ar7rd7v8M
Sorry for misleading.



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