OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gcc.c-torture/] [execute/] [pr39339.c] - Blame information for rev 774

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 688 jeremybenn
struct C
2
{
3
  unsigned int c;
4
  struct D
5
  {
6
    unsigned int columns : 4;
7
    unsigned int fore : 12;
8
    unsigned int back : 6;
9
    unsigned int fragment : 1;
10
    unsigned int standout : 1;
11
    unsigned int underline : 1;
12
    unsigned int strikethrough : 1;
13
    unsigned int reverse : 1;
14
    unsigned int blink : 1;
15
    unsigned int half : 1;
16
    unsigned int bold : 1;
17
    unsigned int invisible : 1;
18
    unsigned int pad : 1;
19
  } attr;
20
};
21
 
22
struct A
23
{
24
  struct C *data;
25
  unsigned int len;
26
};
27
 
28
struct B
29
{
30
  struct A *cells;
31
  unsigned char soft_wrapped : 1;
32
};
33
 
34
struct E
35
{
36
  long row, col;
37
  struct C defaults;
38
};
39
 
40
__attribute__ ((noinline))
41
void foo (struct E *screen, unsigned int c, int columns, struct B *row)
42
{
43
  struct D attr;
44
  long col;
45
  int i;
46
  col = screen->col;
47
  attr = screen->defaults.attr;
48
  attr.columns = columns;
49
  row->cells->data[col].c = c;
50
  row->cells->data[col].attr = attr;
51
  col++;
52
  attr.fragment = 1;
53
  for (i = 1; i < columns; i++)
54
    {
55
      row->cells->data[col].c = c;
56
      row->cells->data[col].attr = attr;
57
      col++;
58
    }
59
}
60
 
61
int
62
main (void)
63
{
64
  struct E e = {.row = 5,.col = 0,.defaults =
65
      {6, {-1, -1, -1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0}} };
66
  struct C c[4];
67
  struct A a = { c, 4 };
68
  struct B b = { &a, 1 };
69
  struct D d;
70
  __builtin_memset (&c, 0, sizeof c);
71
  foo (&e, 65, 2, &b);
72
  d = e.defaults.attr;
73
  d.columns = 2;
74
  if (__builtin_memcmp (&d, &c[0].attr, sizeof d))
75
    __builtin_abort ();
76
  d.fragment = 1;
77
  if (__builtin_memcmp (&d, &c[1].attr, sizeof d))
78
    __builtin_abort ();
79
  return 0;
80
}
81
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.