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

            Bug ID: 66887
           Summary: trunk/libmpx/mpxrt/mpxrt.c:158: possible performance
                    problem
           Product: gcc
           Version: 6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: other
          Assignee: unassigned at gcc dot gnu.org
          Reporter: dcb314 at hotmail dot com
  Target Milestone: ---

[trunk/libmpx/mpxrt/mpxrt.c:159]: (performance) Buffer 'buffer' is being
written before its old content has been used.

Source code is

  memset (buffer, 0, sizeof (buffer));
  memcpy (buffer,
      (uint8_t *)uctxt->uc_mcontext.fpregs + XSAVE_OFFSET_IN_FPMEM,
      sizeof (struct xsave_struct));

Maybe something like

  memcpy (buffer,
      (uint8_t *)uctxt->uc_mcontext.fpregs + XSAVE_OFFSET_IN_FPMEM,
      sizeof (struct xsave_struct));

  memset (&buffer[sizeof (struct xsave_struct))], 0, sizeof (buffer) - sizeof
(struct xsave_struct)) );

Reply via email to