[Coco] Fwd: MW-C Cross compiler bug - Solved

Jamie Cho silurian at icloud.com
Sun Mar 9 13:04:45 EDT 2014


I tracked the error down to the space() function in cprep19. Basically, it is no longer legal for strcpy() or memcpy() to be sent overlapping arrays, but it is ok with memmove().

The corrected version looks like:
int
space (                         /* shrink spaces to one */
        int a, int b)
{
  register char *cptr;
  char *bptr;
  size_t line_size;

  bptr = cptr = &line[b];

  while (*(++cptr) == ' ');

  if (bptr != cptr - 1)
  {
      line_size = strlen(cptr);
      memmove(bptr + 1, cptr, line_size);
      a -= (cptr - bptr - 1);
  }

  return a;
}

Who is the maintainer of the compiler and where should updates be posted?

Best,
Jamie


More information about the Coco mailing list