File: array-15.c

package info (click to toggle)
gcc-riscv64-unknown-elf 8.3.0.2019.08%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 680,956 kB
  • sloc: ansic: 3,237,715; cpp: 896,882; ada: 772,854; f90: 144,254; asm: 68,788; makefile: 67,456; sh: 29,743; exp: 28,045; objc: 15,273; fortran: 11,885; python: 7,369; pascal: 5,375; awk: 3,725; perl: 2,872; yacc: 316; xml: 311; ml: 285; lex: 198; haskell: 122
file content (52 lines) | stat: -rw-r--r-- 2,522 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/* PR c/69262 */
/* { dg-do compile } */
/* { dg-options "-std=c11 -pedantic-errors" } */

struct S
{
  int a[1][][2]; /* { dg-error "array type has incomplete element type" } */
  /* { dg-message "declaration of .a. as multidimensional array must have bounds" "" { target *-*-* } .-1 } */
};

struct R
{
  int i;
  int a[][]; /* { dg-error "array type has incomplete element type" } */
  /* { dg-message "declaration of .a. as multidimensional array must have bounds" "" { target *-*-* } .-1 } */
};

typedef int T[];
typedef int U[][]; /* { dg-error "array type has incomplete element type" } */
/* { dg-message "declaration of .U. as multidimensional array must have bounds" "" { target *-*-* } .-1 } */

int x[][]; /* { dg-error "array type has incomplete element type" } */
/* { dg-message "declaration of .x. as multidimensional array must have bounds" "" { target *-*-* } .-1 } */

struct N;

void
fn1 (int z[][]) /* { dg-error "array type has incomplete element type" } */
/* { dg-message "declaration of .z. as multidimensional array must have bounds" "" { target *-*-* } .-1 } */
{
  int a[1][][2]; /* { dg-error "array type has incomplete element type" } */
  /* { dg-message "declaration of .a. as multidimensional array must have bounds" "" { target *-*-* } .-1 } */
  /* OK */
  int b[3][2][1];
  int c[1][2][3][]; /* { dg-error "array type has incomplete element type" } */
  /* { dg-message "declaration of .c. as multidimensional array must have bounds" "" { target *-*-* } .-1 } */
  T d[1]; /* { dg-error "array type has incomplete element type" } */
  /* { dg-message "declaration of .d. as multidimensional array must have bounds" "" { target *-*-* } .-1 } */
  T e[]; /* { dg-error "array type has incomplete element type" } */
  /* { dg-message "declaration of .e. as multidimensional array must have bounds" "" { target *-*-* } .-1 } */

  /* This array has incomplete element type, but is not multidimensional.  */
  struct N f[1]; /* { dg-error "array type has incomplete element type" } */
  /* { dg-bogus "declaration of .f. as multidimensional array must have bounds" "" { target *-*-* } .-1 } */
}

void fn2 (int [][]); /* { dg-error "array type has incomplete element type" } */
/* { dg-message "declaration of multidimensional array must have bounds" "" { target *-*-* } .-1 } */
/* OK */
void fn3 (int [][*]);
void fn4 (T []); /* { dg-error "array type has incomplete element type" } */
/* { dg-message "declaration of multidimensional array must have bounds" "" { target *-*-* } .-1 } */