OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [gcc/] [testsuite/] [gcc.dg/] [array-4.c] - Blame information for rev 298

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 298 jeremybenn
/* { dg-do run } */
2
/* { dg-options "" } */
3
 
4
/* Verify that GCC's initialized flexible array member extension
5
   works properly.  */
6
 
7
extern void abort(void);
8
extern void exit(int);
9
 
10
struct f { int w; int x[]; };
11
struct g { int w; int x[0]; };
12
 
13
static struct f f = { 4, { 0, 1, 2, 3 } };
14
static int junk1[] = { -1, -1, -1, -1 };
15
static struct g g = { 4, { 0, 1, 2, 3 } }; /* { dg-warning "(excess elements)|(near initialization)" "" } */
16
static int junk2[] = { -1, -1, -1, -1 };
17
 
18
int main()
19
{
20
  int i;
21
  for (i = 0; i < f.w; ++i)
22
    if (f.x[i] != i)
23
      abort ();
24
  exit(0);
25
}

powered by: WebSVN 2.1.0

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