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.

gcc/common/config/riscv/
        PR target/125853
        * 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.
---
 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 74929381a06..16df0c25983 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;
@@ -2194,7 +2192,6 @@ riscv_compute_multilib (
       result =
        riscv_multi_lib_info_t::parse (
          &multilib_info,
-         std::string (this_path, this_path_len),
          option_conds);
 
       if (result)
-- 
2.52.0

Reply via email to