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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gcc.dg/] [c99-vla-2.c] - Blame information for rev 706

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

Line No. Rev Author Line
1 689 jeremybenn
/* Test composite type of VLA and fixed-size array: should be the
2
   fixed-size type.  Bug 22192.  */
3
/* Origin: Joseph Myers <joseph@codesourcery.com> */
4
/* { dg-do compile } */
5
/* { dg-options "-std=iso9899:1999 -pedantic-errors" } */
6
 
7
/* Test that the given expression (of pointer-to-array type) points to
8
   the right sort of array.  */
9
#define TEST_FIXED_SIZE(a) do { static int x[sizeof(*(a))]; (void)x; } while (0)
10
#define TEST_VLA(a) do { (void)sizeof(*(a)); (void)(1 ? (a) : (__typeof__(**(a)) (*)[1])0); (void)(1 ? (a) : (__typeof__(**(a)) (*)[2])0); } while (0)
11
#define TEST_INCOMPLETE(a) do { __typeof__(*(a)) x = { 0 }; (void)x; (void)(1 ? a : (__typeof__(**(a)) (*)[1])0); (void)(1 ? a : (__typeof__(**(a)) (*)[2])0); } while (0)
12
 
13
#define TEST_COMP_FIX(a, b) TEST_FIXED_SIZE(i ? a : b)
14
#define TEST_COMP_VLA(a, b) TEST_VLA(i ? a : b)
15
#define TEST_COMP_INC(a, b) TEST_INCOMPLETE(i ? a : b)
16
 
17
void
18
foo (int i, int j)
19
{
20
  typedef int I;
21
  int (*pf)[2];
22
  int (*pv)[i];
23
  int (*pi)[];
24
  I (*pfI)[2];
25
  I (*pvI)[i];
26
  I (*piI)[];
27
  TEST_COMP_FIX(pf, pf);
28
  TEST_COMP_FIX(pf, pv);
29
  TEST_COMP_FIX(pf, pi);
30
  TEST_COMP_FIX(pf, pfI);
31
  TEST_COMP_FIX(pf, pvI);
32
  TEST_COMP_FIX(pf, piI);
33
  TEST_COMP_FIX(pv, pf);
34
  TEST_COMP_VLA(pv, pv);
35
  TEST_COMP_VLA(pv, pi);
36
  TEST_COMP_FIX(pv, pfI);
37
  TEST_COMP_VLA(pv, pvI);
38
  TEST_COMP_VLA(pv, piI);
39
  TEST_COMP_FIX(pi, pf);
40
  TEST_COMP_VLA(pi, pv);
41
  TEST_COMP_INC(pi, pi);
42
  TEST_COMP_FIX(pi, pfI);
43
  TEST_COMP_VLA(pi, pvI);
44
  TEST_COMP_INC(pi, piI);
45
  TEST_COMP_FIX(pfI, pf);
46
  TEST_COMP_FIX(pfI, pv);
47
  TEST_COMP_FIX(pfI, pi);
48
  TEST_COMP_FIX(pfI, pfI);
49
  TEST_COMP_FIX(pfI, pvI);
50
  TEST_COMP_FIX(pfI, piI);
51
  TEST_COMP_FIX(pvI, pf);
52
  TEST_COMP_VLA(pvI, pv);
53
  TEST_COMP_VLA(pvI, pi);
54
  TEST_COMP_FIX(pvI, pfI);
55
  TEST_COMP_VLA(pvI, pvI);
56
  TEST_COMP_VLA(pvI, piI);
57
  TEST_COMP_FIX(piI, pf);
58
  TEST_COMP_VLA(piI, pv);
59
  TEST_COMP_INC(piI, pi);
60
  TEST_COMP_FIX(piI, pfI);
61
  TEST_COMP_VLA(piI, pvI);
62
  TEST_COMP_INC(piI, piI);
63
  typedef int (*Ti)[i];
64
  typedef int (*Tj)[j];
65
  Ti (*qf)[2];
66
  Ti (*qv)[i];
67
  Ti (*qi)[];
68
  Tj (*rf)[2];
69
  Tj (*rv)[j];
70
  Tj (*ri)[];
71
  TEST_COMP_FIX(qf, qf);
72
  TEST_COMP_FIX(qf, qv);
73
  TEST_COMP_FIX(qf, qi);
74
  TEST_COMP_FIX(qf, rf);
75
  TEST_COMP_FIX(qf, rv);
76
  TEST_COMP_FIX(qf, ri);
77
  TEST_COMP_FIX(qv, qf);
78
  TEST_COMP_VLA(qv, qv);
79
  TEST_COMP_VLA(qv, qi);
80
  TEST_COMP_FIX(qv, rf);
81
  TEST_COMP_VLA(qv, rv);
82
  TEST_COMP_VLA(qv, ri);
83
  TEST_COMP_FIX(qi, qf);
84
  TEST_COMP_VLA(qi, qv);
85
  TEST_COMP_INC(qi, qi);
86
  TEST_COMP_FIX(qi, rf);
87
  TEST_COMP_VLA(qi, rv);
88
  TEST_COMP_INC(qi, ri);
89
  TEST_COMP_FIX(rf, qf);
90
  TEST_COMP_FIX(rf, qv);
91
  TEST_COMP_FIX(rf, qi);
92
  TEST_COMP_FIX(rf, rf);
93
  TEST_COMP_FIX(rf, rv);
94
  TEST_COMP_FIX(rf, ri);
95
  TEST_COMP_FIX(rv, qf);
96
  TEST_COMP_VLA(rv, qv);
97
  TEST_COMP_VLA(rv, qi);
98
  TEST_COMP_FIX(rv, rf);
99
  TEST_COMP_VLA(rv, rv);
100
  TEST_COMP_VLA(rv, ri);
101
  TEST_COMP_FIX(ri, qf);
102
  TEST_COMP_VLA(ri, qv);
103
  TEST_COMP_INC(ri, qi);
104
  TEST_COMP_FIX(ri, rf);
105
  TEST_COMP_VLA(ri, rv);
106
  TEST_COMP_INC(ri, ri);
107
}

powered by: WebSVN 2.1.0

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