https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98110

--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
&current_value is passed to do_lookup_x call which does modify it in some
cases, e.g.
       result->s = sym;
       result->m = (struct link_map *) map;
or passes it to other function, do_lookup_unique, which can perform similar
changes.
But it happens only early:
  for (size_t start = i; *scope != 
# 854 "dl-lookup.c" 3 4
                                  ((void *)0)
# 854 "dl-lookup.c"
                                      ; start = 0, ++scope)
    if (do_lookup_x (undef_name, new_hash, &old_hash, *ref,
       &current_value, *scope, start, version, flags,
       skip_map, type_class, undef_map) != 0)
      break;
and then current_value is no longer modified, so unless I've missed do_lookup_x
remembering the address of current_value somewhere, that optimization seems to
be ok.

Reply via email to