]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/testsuite/gcc.dg/utf-inc-init.c
replace ISL with isl
[thirdparty/gcc.git] / gcc / testsuite / gcc.dg / utf-inc-init.c
CommitLineData
c466b2cd
KVH
1/* Contributed by Kris Van Hees <kris.van.hees@oracle.com> */
2/* Test incremental initializers for char16_t/char32_t arrays. */
5b21d7b2 3/* { dg-do run { target int32plus } } */
c466b2cd
KVH
4/* { dg-options "-std=gnu99" } */
5
6typedef __SIZE_TYPE__ size_t;
ad914b4e
JM
7typedef __CHAR16_TYPE__ char16_t;
8typedef __CHAR32_TYPE__ char32_t;
c466b2cd
KVH
9
10extern int memcmp (const void *, const void *, size_t);
11extern void abort (void);
12extern void exit (int);
13
14struct A {
15 char16_t S[6];
16 int M;
17} a[] = { { { u"foo" }, 1 }, [0].S[2] = u'x', [0].S[4] = u'y' };
18struct A b[] = { { { u"foo" }, 1 }, [0] = { .S[0] = u'b' } };
19struct A c[] = { { { u"foo" }, 1 }, [0].S = { u"a" }, [0].M = 2 };
20
21struct B {
22 char32_t S[6];
23 int M;
24} d[] = { { { U"foo" }, 1 }, [0].S[2] = U'x', [0].S[4] = U'y' };
25struct B e[] = { { { U"foo" }, 1 }, [0] = { .S[0] = U'b' } };
26struct B f[] = { { { U"foo" }, 1 }, [0].S = { U"a" }, [0].M = 2 };
27
28int main (void)
29{
30 if (memcmp (a[0].S, u"fox\0y", 6 * sizeof(char16_t)) || a[0].M != 1)
31 abort ();
32 if (memcmp (b[0].S, u"b\0\0\0\0", 6) || b[0].M)
33 abort ();
34 if (memcmp (c[0].S, u"a\0\0\0\0", 6) || c[0].M != 2)
35 abort ();
36
37 if (memcmp (d[0].S, U"fox\0y", 6 * sizeof(char32_t)) || d[0].M != 1)
38 abort ();
39 if (memcmp (e[0].S, U"b\0\0\0\0", 6) || e[0].M)
40 abort ();
41 if (memcmp (f[0].S, U"a\0\0\0\0", 6) || f[0].M != 2)
42 abort ();
43
44 exit(0);
45}