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.2.2/] [gcc/] [testsuite/] [gcc.dg/] [array-5.c] - Blame information for rev 154

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 149 jeremybenn
/* { dg-do compile } */
2
/* { dg-options "" } */
3
 
4
/* Check compatibility of array declarations.  */
5
 
6
/* Incomplete decl matches.  */
7
extern char arr0[];
8
char arr0[1];
9
 
10
/* Two integral expressions must be the same.  Note that 0 is
11
   a gcc extension, but it should work like any other constant.  */
12
extern char arr1[1];
13
char arr1[1];
14
extern char arr2[0];
15
char arr2[0];
16
extern char arr3[0];            /* { dg-error "previous declaration" } */
17
char arr3[1];                   /* { dg-error "conflicting types" } */
18
 
19
/* Variable size matches.  */
20
void func(int n, int m)
21
{
22
  /* The next two are from the example in c99 6.7.5.2/9.  */
23
  {
24
    /* Invalid: not compatible because 4 != 6.  */
25
    int a[n][6][m];
26
    int (*p)[4][n+1];
27
    p = a;                      /* { dg-error "incompatible" } */
28
  }
29
  {
30
    /* Compatible, but defined behavior only if n == 6 and m == n+1.  */
31
    int c[n][n][6][m];
32
    int (*r)[n][n][n+1];
33
    r = c;
34
  }
35
  {
36
    /* Compatible, but undefined behavior; (2, 2) is not a constant
37
       expression, and thus A is a VLA.  */
38
    int a[6][(2, 2)];
39
    int (*p)[3];
40
    p = a; /* { dg-bogus "incompatible" "bad vla handling" } */
41
  }
42
}

powered by: WebSVN 2.1.0

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