libgfortran/ChangeLog:
[official-gcc.git] / gcc / testsuite / gcc.dg / pr59605.c
blob5f87c99b017676fe4f3bf6e21e9ef174fc0c5011
1 /* { dg-do compile } */
2 /* { dg-options "-O2" } */
3 /* { dg-additional-options "-minline-stringops-dynamically" { target { i?86-*-* x86_64-*-* } } } */
5 extern void abort (void);
7 #define MAX_OFFSET (sizeof (long long))
8 #ifndef MAX_COPY
9 #define MAX_COPY (1024 + 8192)
10 #endif
11 #define MAX_EXTRA (sizeof (long long))
13 #define MAX_LENGTH (MAX_OFFSET + MAX_COPY + MAX_EXTRA)
15 static union {
16 char buf[MAX_LENGTH];
17 long long align_int;
18 long double align_fp;
19 } u;
21 char A[MAX_LENGTH];
23 int
24 main ()
26 int off, len, i;
27 char *p, *q;
29 for (i = 0; i < MAX_LENGTH; i++)
30 A[i] = 'A';
32 for (off = 0; off < MAX_OFFSET; off++)
33 for (len = 1; len < MAX_COPY; len++)
35 for (i = 0; i < MAX_LENGTH; i++)
36 u.buf[i] = 'a';
38 p = __builtin_memcpy (u.buf + off, A, len);
39 if (p != u.buf + off)
40 abort ();
42 q = u.buf;
43 for (i = 0; i < off; i++, q++)
44 if (*q != 'a')
45 abort ();
47 for (i = 0; i < len; i++, q++)
48 if (*q != 'A')
49 abort ();
51 for (i = 0; i < MAX_EXTRA; i++, q++)
52 if (*q != 'a')
53 abort ();
56 return 0;