S/390: Allow immediates in loc expander
[official-gcc.git] / gcc / testsuite / gcc.dg / pr58981.c
blob1c8293e498523d3ecb1c7a5f77a357310222b0d7
1 /* { dg-do run } */
2 /* { dg-options "-O2" } */
3 /* { dg-additional-options "-minline-all-stringops" { target { i?86-*-* x86_64-*-* } } } */
5 extern void abort (void);
7 #define MAX_OFFSET (sizeof (long long))
8 #define MAX_COPY (8 * sizeof (long long))
9 #define MAX_EXTRA (sizeof (long long))
11 #define MAX_LENGTH (MAX_OFFSET + MAX_COPY + MAX_EXTRA)
13 static union {
14 char buf[MAX_LENGTH];
15 long long align_int;
16 long double align_fp;
17 } u;
19 char A[MAX_LENGTH];
21 int
22 main ()
24 int off, len, i;
25 char *p, *q;
27 for (i = 0; i < MAX_LENGTH; i++)
28 A[i] = 'A';
30 for (off = 0; off < MAX_OFFSET; off++)
31 for (len = 1; len < MAX_COPY; len++)
33 for (i = 0; i < MAX_LENGTH; i++)
34 u.buf[i] = 'a';
36 p = __builtin_memcpy (u.buf + off, A, len);
37 if (p != u.buf + off)
38 abort ();
40 q = u.buf;
41 for (i = 0; i < off; i++, q++)
42 if (*q != 'a')
43 abort ();
45 for (i = 0; i < len; i++, q++)
46 if (*q != 'A')
47 abort ();
49 for (i = 0; i < MAX_EXTRA; i++, q++)
50 if (*q != 'a')
51 abort ();
54 return 0;