summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.c-torture/execute/pr39339.c
diff options
context:
space:
mode:
authorupstream source tree <ports@midipix.org>2015-03-15 20:14:05 -0400
committerupstream source tree <ports@midipix.org>2015-03-15 20:14:05 -0400
commit554fd8c5195424bdbcabf5de30fdc183aba391bd (patch)
tree976dc5ab7fddf506dadce60ae936f43f58787092 /gcc/testsuite/gcc.c-torture/execute/pr39339.c
downloadcbb-gcc-4.6.4-554fd8c5195424bdbcabf5de30fdc183aba391bd.tar.bz2
cbb-gcc-4.6.4-554fd8c5195424bdbcabf5de30fdc183aba391bd.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.c-torture/execute/pr39339.c')
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/pr39339.c81
1 files changed, 81 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.c-torture/execute/pr39339.c b/gcc/testsuite/gcc.c-torture/execute/pr39339.c
new file mode 100644
index 000000000..6c1b9e72e
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/pr39339.c
@@ -0,0 +1,81 @@
+struct C
+{
+ unsigned int c;
+ struct D
+ {
+ unsigned int columns : 4;
+ unsigned int fore : 12;
+ unsigned int back : 6;
+ unsigned int fragment : 1;
+ unsigned int standout : 1;
+ unsigned int underline : 1;
+ unsigned int strikethrough : 1;
+ unsigned int reverse : 1;
+ unsigned int blink : 1;
+ unsigned int half : 1;
+ unsigned int bold : 1;
+ unsigned int invisible : 1;
+ unsigned int pad : 1;
+ } attr;
+};
+
+struct A
+{
+ struct C *data;
+ unsigned int len;
+};
+
+struct B
+{
+ struct A *cells;
+ unsigned char soft_wrapped : 1;
+};
+
+struct E
+{
+ long row, col;
+ struct C defaults;
+};
+
+__attribute__ ((noinline))
+void foo (struct E *screen, unsigned int c, int columns, struct B *row)
+{
+ struct D attr;
+ long col;
+ int i;
+ col = screen->col;
+ attr = screen->defaults.attr;
+ attr.columns = columns;
+ row->cells->data[col].c = c;
+ row->cells->data[col].attr = attr;
+ col++;
+ attr.fragment = 1;
+ for (i = 1; i < columns; i++)
+ {
+ row->cells->data[col].c = c;
+ row->cells->data[col].attr = attr;
+ col++;
+ }
+}
+
+int
+main (void)
+{
+ struct E e = {.row = 5,.col = 0,.defaults =
+ {6, {-1, -1, -1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0}} };
+ struct C c[4];
+ struct A a = { c, 4 };
+ struct B b = { &a, 1 };
+ struct D d;
+ __builtin_memset (&c, 0, sizeof c);
+ foo (&e, 65, 2, &b);
+ d = e.defaults.attr;
+ d.columns = 2;
+ if (__builtin_memcmp (&d, &c[0].attr, sizeof d))
+ __builtin_abort ();
+ d.fragment = 1;
+ if (__builtin_memcmp (&d, &c[1].attr, sizeof d))
+ __builtin_abort ();
+ return 0;
+}
+