aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/atomic/pr65345-4.c
blob: 6d44def7c2d4f73fbea14cf91213ffaa83c7456d (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
/* PR c/65345 */
/* { dg-options "" } */

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

_Atomic float i = 5;
_Atomic float j = 2;

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

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

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

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

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

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

int
main ()
{
  float a[10];
  float 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);
}