summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.c-torture/execute/pr43236.c
blob: 0401c88a3dcc27974ea03bba8d2fc2922db9b637 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
/* { dg-options "-ftree-loop-distribution" } */
extern void abort(void);
extern void *memset(void *s, int c, __SIZE_TYPE__ n);
extern int memcmp(const void *s1, const void *s2, __SIZE_TYPE__ n);
/*extern int printf(const char *format, ...);*/

int main()
{
  char A[30], B[30], C[30];
  int i;

  /* prepare arrays */
  memset(A, 1, 30);
  memset(B, 1, 30);

  for (i = 20; i-- > 10;) {
    A[i] = 0;
    B[i] = 0;
  }

  /* expected result */
  memset(C, 1, 30);
  memset(C + 10, 0, 10);

  /* show result */
/*  for (i = 0; i < 30; i++)
    printf("%d %d %d\n", A[i], B[i], C[i]); */

  /* compare results */
  if (memcmp(A, C, 30) || memcmp(B, C, 30)) abort();
  return 0;
}