[Bug optimization/14593] New: [tree-ssa] bcopy is mysteriously replaced with memcpy

kazu at cs dot umass dot edu gcc-bugzilla@gcc.gnu.org
Tue Mar 16 04:32:00 GMT 2004


Reduced from gcc.c-torture/execute/builtins/string-asm-2*

typedef __SIZE_TYPE__ size_t;
extern void abort (void);
extern void bcopy (const void *, void *, size_t);

char y[64] = "foX";

void *
memcpy (void *d, const void *s, size_t n)
{
  char *dst = (char *) d;
  const char *src = (const char *) s;
  while (n--)
    *dst++ = *src++;
  return (char *) d;
}

int
main (void)
{
  bcopy (y + 1, y + 2, 3);
  if (y[3] != 'X')
    abort ();

  return 0;
}

With -O0, bcopy stays as is in the final assembly output.
With -O1 and above, bcopy is somehow transformed into memcpy.

This problem seems to occur at expand-time.

On mainline, this problem does not exist.

-- 
           Summary: [tree-ssa] bcopy is mysteriously replaced with memcpy
           Product: gcc
           Version: tree-ssa
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: kazu at cs dot umass dot edu
                CC: gcc-bugs at gcc dot gnu dot org
GCC target triplet: h8300-elf


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14593



More information about the Gcc-bugs mailing list