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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gcc.dg/] [array-init-2.c] - Blame information for rev 754

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

Line No. Rev Author Line
1 689 jeremybenn
/* Test array initializion by store_by_pieces.  */
2
/* { dg-do run } */
3
/* { dg-options "-O2" } */
4
 
5
struct A { char c[10]; };
6
extern void abort (void);
7
 
8
void
9
__attribute__((noinline))
10
check (struct A * a, int b)
11
{
12
  const char *p;
13
  switch (b)
14
    {
15
    case 0:
16
      p = "abcdefghi";
17
      break;
18
    case 1:
19
      p = "j\0\0\0\0\0\0\0\0";
20
      break;
21
    case 2:
22
      p = "kl\0\0\0\0\0\0\0";
23
      break;
24
    case 3:
25
      p = "mnop\0\0\0\0\0";
26
      break;
27
    case 4:
28
      p = "qrstuvwx\0";
29
      break;
30
    default:
31
      abort ();
32
    }
33
  if (__builtin_memcmp (a->c, p, 10) != 0)
34
    abort ();
35
}
36
 
37
int
38
main (void)
39
{
40
  struct A a = { "abcdefghi" };
41
  check (&a, 0);
42
  struct A b = { "j" };
43
  check (&b, 1);
44
  struct A c = { "kl" };
45
  check (&c, 2);
46
  struct A d = { "mnop" };
47
  check (&d, 3);
48
  struct A e = { "qrstuvwx" };
49
  check (&e, 4);
50
  return 0;
51
}

powered by: WebSVN 2.1.0

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