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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gcc.dg/] [vla-13.c] - Blame information for rev 689

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 689 jeremybenn
/* Test for VLA size evaluation; see PR 35198.  */
2
/* Origin: Joseph Myers <joseph@codesourcery.com> */
3
/* { dg-do run } */
4
/* { dg-options "-std=c99" } */
5
 
6
extern void exit (int);
7
extern void abort (void);
8
 
9
int i;
10
void *p;
11
 
12
void
13
f1 (void *x, int j)
14
{
15
  p = (int (*)[++i])x;
16
  if (i != j)
17
    abort ();
18
}
19
 
20
void
21
f1c (void *x, int j)
22
{
23
  p = (int (*)[++i]){x};
24
  if (i != j)
25
    abort ();
26
}
27
 
28
void
29
f2 (void *x, int j)
30
{
31
  x = (void *)(int (*)[++i])p;
32
  if (i != j)
33
    abort ();
34
}
35
 
36
void
37
f2c (void *x, int j)
38
{
39
  x = (void *)(int (*)[++i]){p};
40
  if (i != j)
41
    abort ();
42
}
43
 
44
void
45
f3 (void *x, int j)
46
{
47
  (void)(int (*)[++i])p;
48
  if (i != j)
49
    abort ();
50
}
51
 
52
void
53
f3c (void *x, int j)
54
{
55
  (void)(int (*)[++i]){p};
56
  if (i != j)
57
    abort ();
58
}
59
 
60
void
61
f4 (void *x, int j)
62
{
63
  (int (*)[++i])p;
64
  (int (*)[++i])p;
65
  if (i != j)
66
    abort ();
67
}
68
 
69
void
70
f4c (void *x, int j)
71
{
72
  (int (*)[++i]){p};
73
  (int (*)[++i]){p};
74
  if (i != j)
75
    abort ();
76
}
77
 
78
void
79
f5c (void *x, int j, int k)
80
{
81
  (++i, f3c (x, j), (int (*)[++i]){p});
82
  if (i != k)
83
    abort ();
84
}
85
 
86
int
87
main (void)
88
{
89
  f1 (p, 1);
90
  f2 (p, 2);
91
  f3 (p, 3);
92
  f4 (p, 5);
93
  f1c (p, 6);
94
  f2c (p, 7);
95
  f3c (p, 8);
96
  f4c (p, 10);
97
  f5c (p, 12, 13);
98
  exit (0);
99
}

powered by: WebSVN 2.1.0

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