aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph Müllner <christoph.muellner@vrull.eu>2024-12-19 20:59:36 +0100
committerChristoph Müllner <christoph.muellner@vrull.eu>2024-12-20 10:42:18 +0100
commit8af296c290216e03bc20e7291e64c19e0d94cfd6 (patch)
tree64882e8e89a9923f07f3796b5afc9b4c9fc9343f
parent92216cbc59b3a4566d49de5dfa059b70b03d639a (diff)
downloadgcc-8af296c290216e03bc20e7291e64c19e0d94cfd6.zip
gcc-8af296c290216e03bc20e7291e64c19e0d94cfd6.tar.gz
gcc-8af296c290216e03bc20e7291e64c19e0d94cfd6.tar.bz2
RISC-V: List valid -mtune options only once
This patch ensures that the list of valid -mtune options does not contain entries more than once. The -mtune option accepts CPU identifiers as well as tuning identifiers and there are cases where a CPU and its tuning have the same identifier. PR116347 gcc/ChangeLog: * common/config/riscv/riscv-common.cc (riscv_get_valid_option_values): Skip adding mtune entries that are already in the list. Signed-off-by: Christoph Müllner <christoph.muellner@vrull.eu>
-rw-r--r--gcc/common/config/riscv/riscv-common.cc14
1 files changed, 13 insertions, 1 deletions
diff --git a/gcc/common/config/riscv/riscv-common.cc b/gcc/common/config/riscv/riscv-common.cc
index 4c9a72d..2f85bb2 100644
--- a/gcc/common/config/riscv/riscv-common.cc
+++ b/gcc/common/config/riscv/riscv-common.cc
@@ -2437,7 +2437,19 @@ riscv_get_valid_option_values (int option_code,
const riscv_cpu_info *cpu_info = &riscv_cpu_tables[0];
for (;cpu_info->name; ++cpu_info)
- v.safe_push (cpu_info->name);
+ {
+ /* Skip duplicates. */
+ bool skip = false;
+ int i;
+ const char *str;
+ FOR_EACH_VEC_ELT (v, i, str)
+ {
+ if (!strcmp (str, cpu_info->name))
+ skip = true;
+ }
+ if (!skip)
+ v.safe_push (cpu_info->name);
+ }
}
break;
case OPT_mcpu_: