[Bug lto/97586] [11 Regression] "make check" failures in binutils with -flto since r11-3641-gc34db4b6f8a5d803

marxin at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Oct 27 09:21:23 GMT 2020


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

--- Comment #7 from Martin Liška <marxin at gcc dot gnu.org> ---
So the _bfd_safe_read_leb128.constprop removes the first unused argument:

bfd_vma
_bfd_safe_read_leb128 (bfd *abfd ATTRIBUTE_UNUSED,
                       bfd_byte *data,
                       unsigned int *length_return,
                       bfd_boolean sign,
                       const bfd_byte * const end)
{
  bfd_vma result = 0;
  unsigned int num_read = 0;
  unsigned int shift = 0;
  unsigned char byte = 0;

  while (data < end)
    {
      byte = bfd_get_8 (abfd, data);
      data++;
      num_read++;

      result |= ((bfd_vma) (byte & 0x7f)) << shift;

      shift += 7;
      if ((byte & 0x80) == 0)
        break;
    }

  if (length_return != NULL)
    *length_return = num_read;

  if (sign && (shift < 8 * sizeof (result)) && (byte & 0x40))
    result |= -((bfd_vma) 1 << shift);

  return result;
}

But the analysis is bogus:

ipa-modref: call to _bfd_safe_read_leb128.constprop/17919 does not clobber ref:
bytes_read alias sets: 7->7

The &bytes_read is always modified in the function (if it's non-null).


More information about the Gcc-bugs mailing list