summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/sync-fetch.c
blob: 44b6cdc2a8b5a5e65521dc9da04149a7b1539bd9 (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
/* PR c/69405 - [6 Regression] ICE in c_tree_printer on an invalid
   __atomic_fetch_add */
/* Test to verify that the diagnostic doesn't cause an ICE when any
   of the arguments to __atomic_fetch_OP is undeclared.  */
/* { dg-do compile } */

void test_add_undeclared_first_arg (void)
{
  int a = 0;
  __atomic_fetch_add (&a, &b, 0);   /* { dg-error ".b. undeclared" } */
}

void test_sub_undeclared_first_arg (void)
{
  int a = 0;
  __atomic_fetch_sub (&a, &b, 0);      /* { dg-error ".b. undeclared" } */
}

void test_or_undeclared_first_arg (void)
{
  int a = 0;
  __atomic_fetch_or (&a, &b, 0);      /* { dg-error ".b. undeclared" } */
}

void test_and_undeclared_first_arg (void)
{
  int a = 0;
  __atomic_fetch_and (&a, &b, 0);      /* { dg-error ".b. undeclared" } */
}

void test_xor_undeclared_first_arg (void)
{
  int a = 0;
  __atomic_fetch_xor (&a, &b, 0);      /* { dg-error ".b. undeclared" } */
}

void test_nand_undeclared_first_arg (void)
{
  int a = 0;
  __atomic_fetch_nand (&a, &b, 0);      /* { dg-error ".b. undeclared" } */
}


void test_add_undeclared_second_arg (void)
{
  int b = 0;
  __atomic_fetch_add (&a, &b, 0);   /* { dg-error ".a. undeclared" } */
}

void test_sub_undeclared_second_arg (void)
{
  int b = 0;
  __atomic_fetch_sub (&a, &b, 0);      /* { dg-error ".a. undeclared" } */
}

void test_or_undeclared_second_arg (void)
{
  int b = 0;
  __atomic_fetch_or (&a, &b, 0);      /* { dg-error ".a. undeclared" } */
}

void test_and_undeclared_second_arg (void)
{
  int b = 0;
  __atomic_fetch_and (&a, &b, 0);      /* { dg-error ".a. undeclared" } */
}

void test_xor_undeclared_second_arg (void)
{
  int b = 0;
  __atomic_fetch_xor (&a, &b, 0);      /* { dg-error ".a. undeclared" } */
}

void test_nand_undeclared_second_arg (void)
{
  int b = 0;
  __atomic_fetch_nand (&a, &b, 0);      /* { dg-error ".a. undeclared" } */
}


void test_add_undeclared_third_arg (void)
{
  int a = 0, b = 0;
  __atomic_fetch_add (&a, &b, m);   /* { dg-error ".m. undeclared" } */
}

void test_sub_undeclared_third_arg (void)
{
  int a = 0, b = 0;
  __atomic_fetch_sub (&a, &b, m);      /* { dg-error ".m. undeclared" } */
}

void test_or_undeclared_third_arg (void)
{
  int a = 0, b = 0;
  __atomic_fetch_or (&a, &b, m);      /* { dg-error ".m. undeclared" } */
}

void test_and_undeclared_third_arg (void)
{
  int a = 0, b = 0;
  __atomic_fetch_and (&a, &b, m);      /* { dg-error ".m. undeclared" } */
}

void test_xor_undeclared_third_arg (void)
{
  int a = 0, b = 0;
  __atomic_fetch_xor (&a, &b, m);      /* { dg-error ".m. undeclared" } */
}

void test_nand_undeclared_third_arg (void)
{
  int a = 0, b = 0;
  __atomic_fetch_nand (&a, &b, m);      /* { dg-error ".m. undeclared" } */
}