Joerg Schilling wrote:
> while (*bp) {
> if (*bp++ == ':') {
> if (*bp == ':' || *bp == ' ' || *bp == '\t') {
> p = bp;
> while (*p)
> if (*p++ == ':')
> break;
> strcpy(bp--, p);
> }
> }
> }
> }
>
> BTW: I would guess it only happens when the overlap is less than 8 chars
> and I believe that new behavior may be a result of the upgraded compiler
> Sun uses.
Yikes. That helped locate it. It happens with a particular buffer
alignment. Here's a condensed example:
#include <stdio.h>
#include <string.h>
void
main(void)
{
char buf[32];
strcpy(buf, "0123456abcdefghijklmnopqrstuvwxyz");
puts(buf);
strcpy(buf+6,buf+7);
puts(buf);
}
A 32-bit executable produces:
0123456abcdefghijklmnopqrstuvwxyz
012345abcdefghijklmnopqrstuvwxyz
A 64-bit executable does:
0123456abcdefghijklmnopqrstuvwxyz
012345abcdefghijlmnoppqrstuvwxyz
Note the doubled 'p' and missing 'k'. It looks like bytes 16-20 got
shifted left somehow.
I think that might be nasty enough to warrant backing down from 129 ...
--
James Carlson 42.703N 71.076W <[email protected]>
_______________________________________________
opensolaris-code mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/opensolaris-code