[clang] [llvm] [RISCV] Support RISC-V Profiles in -march option (PR #76357)

Philip Reames via cfe-commits cfe-commits at lists.llvm.org
Thu Mar 14 11:10:49 PDT 2024


================
@@ -854,6 +854,81 @@ RISCVISAInfo::parseArchString(StringRef Arch, bool EnableExperimentalExtension,
                              "string must be lowercase");
   }
 
+  bool IsProfile = Arch.starts_with("rvi") || Arch.starts_with("rva") ||
+                   Arch.starts_with("rvb") || Arch.starts_with("rvm");
+  std::string NewArch;
----------------
preames wrote:

Please rename NewArch to ArchStorage.  Specifically, we end up with a StringRef bound to this storage, and having it go out of scope before that StringRef would be a use-after-free.  

https://github.com/llvm/llvm-project/pull/76357


More information about the cfe-commits mailing list