public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] RISC-V: Fix bug of TARGET_COMPUTE_MULTILIB implemented in riscv.
@ 2023-02-02 11:46 Jin Ma
  2023-02-02 13:30 ` Kito Cheng
  0 siblings, 1 reply; 2+ messages in thread
From: Jin Ma @ 2023-02-02 11:46 UTC (permalink / raw)
  To: gcc-patches; +Cc: kito.cheng, kito.cheng, palmer, Jin Ma

MAX_MATCH_SCORE is not assigned anywhere except initialized to 0,
causing BEST_MATCH_MULTI_LIB to always be 0 or -1, which will
cause the result of TARGET_COMPUTE_MULTILIB hook to fail.

gcc/ChangeLog:

	* common/config/riscv/riscv-common.cc:
---
 gcc/common/config/riscv/riscv-common.cc | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/gcc/common/config/riscv/riscv-common.cc b/gcc/common/config/riscv/riscv-common.cc
index 616e2f897b9..787674003cb 100644
--- a/gcc/common/config/riscv/riscv-common.cc
+++ b/gcc/common/config/riscv/riscv-common.cc
@@ -1700,7 +1700,10 @@ riscv_compute_multilib (
 
       /* Record highest match score multi-lib setting.  */
       if (match_score > max_match_score)
-	best_match_multi_lib = i;
+	{
+	  best_match_multi_lib = i;
+	  max_match_score = match_score;
+	}
     }
 
   if (best_match_multi_lib == -1)
-- 
2.17.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] RISC-V: Fix bug of TARGET_COMPUTE_MULTILIB implemented in riscv.
  2023-02-02 11:46 [PATCH] RISC-V: Fix bug of TARGET_COMPUTE_MULTILIB implemented in riscv Jin Ma
@ 2023-02-02 13:30 ` Kito Cheng
  0 siblings, 0 replies; 2+ messages in thread
From: Kito Cheng @ 2023-02-02 13:30 UTC (permalink / raw)
  To: Jin Ma; +Cc: gcc-patches, kito.cheng, palmer

Good catch! thanks for fixing that, committed to trunk :)

On Thu, Feb 2, 2023 at 7:46 PM Jin Ma <jinma@linux.alibaba.com> wrote:
>
> MAX_MATCH_SCORE is not assigned anywhere except initialized to 0,
> causing BEST_MATCH_MULTI_LIB to always be 0 or -1, which will
> cause the result of TARGET_COMPUTE_MULTILIB hook to fail.
>
> gcc/ChangeLog:
>
>         * common/config/riscv/riscv-common.cc:
> ---
>  gcc/common/config/riscv/riscv-common.cc | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/gcc/common/config/riscv/riscv-common.cc b/gcc/common/config/riscv/riscv-common.cc
> index 616e2f897b9..787674003cb 100644
> --- a/gcc/common/config/riscv/riscv-common.cc
> +++ b/gcc/common/config/riscv/riscv-common.cc
> @@ -1700,7 +1700,10 @@ riscv_compute_multilib (
>
>        /* Record highest match score multi-lib setting.  */
>        if (match_score > max_match_score)
> -       best_match_multi_lib = i;
> +       {
> +         best_match_multi_lib = i;
> +         max_match_score = match_score;
> +       }
>      }
>
>    if (best_match_multi_lib == -1)
> --
> 2.17.1
>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-02-02 13:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-02 11:46 [PATCH] RISC-V: Fix bug of TARGET_COMPUTE_MULTILIB implemented in riscv Jin Ma
2023-02-02 13:30 ` Kito Cheng

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).