diff options
author | upstream source tree <ports@midipix.org> | 2015-03-15 20:14:05 -0400 |
---|---|---|
committer | upstream source tree <ports@midipix.org> | 2015-03-15 20:14:05 -0400 |
commit | 554fd8c5195424bdbcabf5de30fdc183aba391bd (patch) | |
tree | 976dc5ab7fddf506dadce60ae936f43f58787092 /gcc/testsuite/gcc.dg/utf-inc-init.c | |
download | cbb-gcc-4.6.4-15d2061ac0796199866debe9ac87130894b0cdd3.tar.bz2 cbb-gcc-4.6.4-15d2061ac0796199866debe9ac87130894b0cdd3.tar.xz |
obtained gcc-4.6.4.tar.bz2 from upstream website;upstream
verified gcc-4.6.4.tar.bz2.sig;
imported gcc-4.6.4 source tree from verified upstream tarball.
downloading a git-generated archive based on the 'upstream' tag
should provide you with a source tree that is binary identical
to the one extracted from the above tarball.
if you have obtained the source via the command 'git clone',
however, do note that line-endings of files in your working
directory might differ from line-endings of the respective
files in the upstream repository.
Diffstat (limited to 'gcc/testsuite/gcc.dg/utf-inc-init.c')
-rw-r--r-- | gcc/testsuite/gcc.dg/utf-inc-init.c | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/utf-inc-init.c b/gcc/testsuite/gcc.dg/utf-inc-init.c new file mode 100644 index 000000000..531d21b26 --- /dev/null +++ b/gcc/testsuite/gcc.dg/utf-inc-init.c @@ -0,0 +1,45 @@ +/* Contributed by Kris Van Hees <kris.van.hees@oracle.com> */ +/* Test incremental initializers for char16_t/char32_t arrays. */ +/* { dg-do run { target int32plus } } */ +/* { dg-options "-std=gnu99" } */ + +typedef __SIZE_TYPE__ size_t; +typedef __CHAR16_TYPE__ char16_t; +typedef __CHAR32_TYPE__ char32_t; + +extern int memcmp (const void *, const void *, size_t); +extern void abort (void); +extern void exit (int); + +struct A { + char16_t S[6]; + int M; +} a[] = { { { u"foo" }, 1 }, [0].S[2] = u'x', [0].S[4] = u'y' }; +struct A b[] = { { { u"foo" }, 1 }, [0] = { .S[0] = u'b' } }; +struct A c[] = { { { u"foo" }, 1 }, [0].S = { u"a" }, [0].M = 2 }; + +struct B { + char32_t S[6]; + int M; +} d[] = { { { U"foo" }, 1 }, [0].S[2] = U'x', [0].S[4] = U'y' }; +struct B e[] = { { { U"foo" }, 1 }, [0] = { .S[0] = U'b' } }; +struct B f[] = { { { U"foo" }, 1 }, [0].S = { U"a" }, [0].M = 2 }; + +int main (void) +{ + if (memcmp (a[0].S, u"fox\0y", 6 * sizeof(char16_t)) || a[0].M != 1) + abort (); + if (memcmp (b[0].S, u"b\0\0\0\0", 6) || b[0].M) + abort (); + if (memcmp (c[0].S, u"a\0\0\0\0", 6) || c[0].M != 2) + abort (); + + if (memcmp (d[0].S, U"fox\0y", 6 * sizeof(char32_t)) || d[0].M != 1) + abort (); + if (memcmp (e[0].S, U"b\0\0\0\0", 6) || e[0].M) + abort (); + if (memcmp (f[0].S, U"a\0\0\0\0", 6) || f[0].M != 2) + abort (); + + exit(0); +} |