summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/pr65345-2.c
blob: c9adffb5f5aff9344367fef5237e99e474a84cd3 (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
/* PR c/65345 */
/* { dg-do run } */
/* { dg-require-effective-target sync_int_long } */
/* { dg-options "" } */

#define CHECK(X) if (!(X)) __builtin_abort ()

_Atomic int i = 5;
_Atomic int j = 2;

void
fn1 (int a[i = 0])
{
}

void
fn2 (int a[i += 2])
{
}

void
fn3 (int a[++i])
{
}

void
fn4 (int a[++i])
{
}

void
fn5 (int a[++i][j = 10])
{
}

void
fn6 (int a[i = 7][j--])
{
}

int
main ()
{
  int a[10];
  int aa[10][10];
  fn1 (a);
  CHECK (i == 0);
  fn2 (a);
  CHECK (i == 2);
  fn3 (a);
  CHECK (i == 3);
  fn4 (a);
  CHECK (i == 4);
  fn5 (aa);
  CHECK (i == 5);
  CHECK (j == 10);
  fn6 (aa);
  CHECK (i == 7);
  CHECK (j == 9);
}