tcc-65816/test/tests/20050502-2.c
2017-06-09 13:52:12 +02:00

35 lines
516 B
C

/* PR target/21297 */
typedef __SIZE_TYPE__ size_t;
extern int memcmp (const char *, const char *, size_t);
extern void abort ();
void
foo (char *x)
{
int i;
for (i = 0; i < 2; i++);
x[i + i] = '\0';
}
void
bar (char *x)
{
int i;
for (i = 0; i < 2; i++);
x[i + i + i + i] = '\0';
}
int
main (void)
{
char x[] = "IJKLMNOPQR";
foo (x);
if (memcmp (x, "IJKL\0NOPQR", sizeof x) != 0)
abort ();
x[4] = 'M';
bar (x);
if (memcmp (x, "IJKLMNOP\0R", sizeof x) != 0)
abort ();
return 0;
}