RISC-V: Fix loss of function to script 'multilib-generator'

Message ID 20230321073849.21470-1-zhusonghe@eswincomputing.com
State Accepted
Headers
Series RISC-V: Fix loss of function to script 'multilib-generator' |

Checks

Context Check Description
snail/gcc-patch-check success Github commit url

Commit Message

Songhe Zhu March 21, 2023, 7:38 a.m. UTC
  The arch 'rv32imac' will not be created when excuting
'./multilib-generator rv32imc-ilp32--a'

The output is:
MULTILIB_OPTIONS = march=rv32imc mabi=ilp32
MULTILIB_DIRNAMES = rv32imc ilp32
MULTILIB_REQUIRED = march=rv32imc/mabi=ilp32
MULTILIB_REUSE =

Analysis : The alts:['rv32imc', 'rv32imac'] will change
to ['rv32imac', 'rv32imc'] through function:unique(alts) processing,
This is the wrong alts should not be changed.
This patch fix it.

gcc/ChangLog:
	* config/riscv/multilib-generator: Adjusting the loop of 'alt' in 'alts'.

Signed-off-by: Songhe Zhu <zhusonghe@eswincomputing.com>
---
 gcc/config/riscv/multilib-generator | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Kito Cheng March 23, 2023, 8:33 a.m. UTC | #1
Nice catch, committed to the trunk!

On Tue, Mar 21, 2023 at 3:39 PM Songhe Zhu <zhusonghe@eswincomputing.com> wrote:
>
> The arch 'rv32imac' will not be created when excuting
> './multilib-generator rv32imc-ilp32--a'
>
> The output is:
> MULTILIB_OPTIONS = march=rv32imc mabi=ilp32
> MULTILIB_DIRNAMES = rv32imc ilp32
> MULTILIB_REQUIRED = march=rv32imc/mabi=ilp32
> MULTILIB_REUSE =
>
> Analysis : The alts:['rv32imc', 'rv32imac'] will change
> to ['rv32imac', 'rv32imc'] through function:unique(alts) processing,
> This is the wrong alts should not be changed.
> This patch fix it.
>
> gcc/ChangLog:
>         * config/riscv/multilib-generator: Adjusting the loop of 'alt' in 'alts'.
>
> Signed-off-by: Songhe Zhu <zhusonghe@eswincomputing.com>
> ---
>  gcc/config/riscv/multilib-generator | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/gcc/config/riscv/multilib-generator b/gcc/config/riscv/multilib-generator
> index 9a6ce0223c9..0a3d4c07757 100755
> --- a/gcc/config/riscv/multilib-generator
> +++ b/gcc/config/riscv/multilib-generator
> @@ -175,7 +175,7 @@ for cmodel in cmodels:
>      # Drop duplicated entry.
>      alts = unique(alts)
>
> -    for alt in alts[1:]:
> +    for alt in alts:
>        if alt == arch:
>          continue
>        arches[alt] = 1
> --
> 2.17.1
>
  

Patch

diff --git a/gcc/config/riscv/multilib-generator b/gcc/config/riscv/multilib-generator
index 9a6ce0223c9..0a3d4c07757 100755
--- a/gcc/config/riscv/multilib-generator
+++ b/gcc/config/riscv/multilib-generator
@@ -175,7 +175,7 @@  for cmodel in cmodels:
     # Drop duplicated entry.
     alts = unique(alts)
 
-    for alt in alts[1:]:
+    for alt in alts:
       if alt == arch:
         continue
       arches[alt] = 1