gcc/testsuite/gcc.c-torture/execute/memset-4.c
raw| 1 | /* Test to make sure memset of small old size works |
| 2 | correctly. */ |
| 3 | #define SIZE 15 |
| 4 | |
| 5 | void f(char *a) __attribute__((noinline)); |
| 6 | void f(char *a) |
| 7 | { |
| 8 | __builtin_memset (a, 0, SIZE); |
| 9 | } |
| 10 | |
| 11 | |
| 12 | int main(void) |
| 13 | { |
| 14 | int i; |
| 15 | char b[SIZE]; |
| 16 | for(i = 0; i < sizeof(b); i++) |
| 17 | { |
| 18 | b[i] = i; |
| 19 | } |
| 20 | f(b); |
| 21 | for(i = 0; i < sizeof(b); i++) |
| 22 | { |
| 23 | if (0 != b[i]) |
| 24 | __builtin_abort (); |
| 25 | } |
| 26 | return 0; |
| 27 | } |