]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
[RISC-V][PR target/119865] Don't free ggc allocated memory
authorJeff Law <jlaw@ventanamicro.com>
Sat, 19 Apr 2025 18:35:29 +0000 (12:35 -0600)
committerJeff Law <jlaw@ventanamicro.com>
Sat, 19 Apr 2025 18:35:29 +0000 (12:35 -0600)
Kaiweng's patch to stop freeing riscv_arch_string was correct, but incomplete
as there's another path that was freeing that node, which is just plain wrong
for a node allocated by the GC system.

This patch removes that call to free() which fixes the test.  I've spun it in
my tester and will obviously wait for the pre-commit system to render a verdict
before moving forward.

PR target/119865
gcc/
* config/riscv/riscv.cc (parse_features_for_version): Do not
explicitly free the architecture string.

gcc/config/riscv/riscv.cc

index d3656a7a4307b1c5687628edca5415dc23150ed9..bad59e248d08e8f516a58f9b300f3ff02634f968 100644 (file)
@@ -13136,9 +13136,6 @@ parse_features_for_version (tree decl,
                                          DECL_SOURCE_LOCATION (decl));
   gcc_assert (parse_res);
 
-  if (arch_string != default_opts->x_riscv_arch_string)
-    free (CONST_CAST (void *, (const void *) arch_string));
-
   cl_target_option_restore (&global_options, &global_options_set,
                            &cur_target);
 }