summaryrefslogtreecommitdiff
path: root/05/tcc-0.9.27/tests/tests2/79_vla_continue.c
blob: 91215c99e113355d6f70ae871a4fee0c5dc06a12 (plain)
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
#include <stdio.h>

int f(void)
{
  return 5;
}

void test1()
{
  int count = 10;
  void *addr[10];
  for(;count--;) {
    int a[f()];

    addr[count] = a;

    continue;
  }

  if(addr[9] == addr[0]) {
    printf("OK\n");
  } else {
    printf("NOT OK\n");
  }
}

void test2()
{
  int count = 10;
  void *addr[count];
  for(;count--;) {
    int a[f()];

    addr[count] = a;

    continue;
  }

  if(addr[9] == addr[0]) {
    printf("OK\n");
  } else {
    printf("NOT OK\n");
  }
}

void test3()
{
  int count = 10;
  void *addr[count];
  while(count--) {
    int a[f()];

    addr[count] = a;

    continue;
  }

  if(addr[9] == addr[0]) {
    printf("OK\n");
  } else {
    printf("NOT OK\n");
  }
}

void test4()
{
  int count = 10;
  void *addr[count];
  do {
    int a[f()];

    addr[--count] = a;

    continue;
  } while (count);

  if(addr[9] == addr[0]) {
    printf("OK\n");
  } else {
    printf("NOT OK\n");
  }
}

void test5()
{
  int count = 10;
  int a[f()];
  int c[f()];

  c[0] = 42;

  for(;count--;) {
    int b[f()];
    int i;
    for (i=0; i<f(); i++) {
      b[i] = count;
    }
  }

  if (c[0] == 42) {
    printf("OK\n");
  } else {
    printf("NOT OK\n");
  }
}

int main(void)
{
  test1();
  test2();
  test3();
  test4();
  test5();

  return 0;
}