https://gcc.gnu.org/g:224a90f262811a962c6365a306e826dd479f1265

commit r17-2014-g224a90f262811a962c6365a306e826dd479f1265
Author: Jim Lin <[email protected]>
Date:   Tue Jun 30 07:30:43 2026 -0600

    RISC-V: Fix empty arch_str for native multilib path ".::riscv64-linux-gnu" 
[PR125853]
    
    riscv_multi_lib_info_t::parse received the raw multilib path string
    (e.g. ".::riscv64-linux-gnu" on a native build) and compared it against
    ".".  Because the raw string still carries the multi_os_dir suffix, the
    comparison failed, the default arch/abi branch was skipped, and arch_str
    and abi_str were left empty.  The empty arch_str then flowed into
    riscv_subset_list::parse.
    
    multi_lib_info->path is already truncated at the first ':' to just the
    path component, so use it instead of passing the raw string.
    
            PR target/125853
    gcc/
            * common/config/riscv/riscv-common.cc 
(riscv_multi_lib_info_t::parse):
            Remove the path parameter and compare multi_lib_info->path against
            "." instead.
            (riscv_compute_multilib): Update caller.

Diff:
---
 gcc/common/config/riscv/riscv-common.cc | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/gcc/common/config/riscv/riscv-common.cc 
b/gcc/common/config/riscv/riscv-common.cc
index 828e39261cae..0ecfd814eba9 100644
--- a/gcc/common/config/riscv/riscv-common.cc
+++ b/gcc/common/config/riscv/riscv-common.cc
@@ -332,7 +332,6 @@ struct riscv_multi_lib_info_t {
   riscv_subset_list *subset_list;
 
   static bool parse (struct riscv_multi_lib_info_t *,
-                    const std::string &,
                     const std::vector<std::string> &);
 };
 
@@ -1910,13 +1909,12 @@ prefixed_with (const std::string &str, const char 
*prefix)
 bool
 riscv_multi_lib_info_t::parse (
   struct riscv_multi_lib_info_t *multi_lib_info,
-  const std::string &path,
   const std::vector<std::string> &conds)
 {
   const char *default_arch_str = STRINGIZING (TARGET_RISCV_DEFAULT_ARCH);
   const char *default_abi_str = STRINGIZING (TARGET_RISCV_DEFAULT_ABI);
   multi_lib_info->conds = conds;
-  if (path == ".")
+  if (multi_lib_info->path == ".")
     {
       multi_lib_info->arch_str = default_arch_str;
       multi_lib_info->abi_str = default_abi_str;
@@ -2199,7 +2197,6 @@ riscv_compute_multilib (
       result =
        riscv_multi_lib_info_t::parse (
          &multilib_info,
-         std::string (this_path, this_path_len),
          option_conds);
 
       if (result)

Reply via email to