| 1 |
/* Test whether store motion recognizes pure functions as potentially reading |
| 2 |
any memory. */ |
| 3 |
|
| 4 |
typedef __SIZE_TYPE__ size_t; |
| 5 |
extern void abort (void); |
| 6 |
extern void *memcpy (void *dest, const void *src, size_t n); |
| 7 |
extern size_t strlen (const char *s); |
| 8 |
extern int strcmp (const char *s1, const char *s2) __attribute__((pure)); |
| 9 |
|
| 10 |
char buf[50]; |
| 11 |
|
| 12 |
static void foo (void) |
| 13 |
{ |
| 14 |
if (memcpy (buf, "abc", 4) != buf) abort (); |
| 15 |
if (strcmp (buf, "abc")) abort (); |
| 16 |
memcpy (buf, "abcdefgh", strlen ("abcdefgh") + 1); |
| 17 |
} |
| 18 |
|
| 19 |
int main (void) |
| 20 |
{ |
| 21 |
foo (); |
| 22 |
return 0; |
| 23 |
} |