PR tree-optimization/81384 - built-in form of strnlen missing
[official-gcc.git] / gcc / testsuite / gcc.c-torture / execute / pr36038.c
blobde4bef3d40e9004972922e7b625aa5557ea790bf
1 /* PR tree-optimization/36038 */
3 long long list[10];
4 long long expect[10] = { 0, 1, 2, 3, 4, 4, 5, 6, 7, 9 };
5 long long *stack_base;
6 int indices[10];
7 int *markstack_ptr;
9 void
10 doit (void)
12 long long *src;
13 long long *dst;
14 long long *sp = stack_base + 5;
15 int diff = 2;
16 int shift;
17 int count;
19 shift = diff - (markstack_ptr[-1] - markstack_ptr[-2]);
20 count = (sp - stack_base) - markstack_ptr[-1] + 2;
21 src = sp;
22 dst = (sp += shift);
23 while (--count)
24 *dst-- = *src--;
27 int
28 main ()
30 int i;
31 for (i = 0; i < 10; i++)
32 list[i] = i;
34 markstack_ptr = indices + 9;
35 markstack_ptr[-1] = 2;
36 markstack_ptr[-2] = 1;
38 stack_base = list + 2;
39 doit ();
40 if (__builtin_memcmp (expect, list, sizeof (list)))
41 __builtin_abort ();
42 return 0;